Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 22 Mar 2005 @ 16:52:06 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Deciles Query
 
From:   Michael Larkins

Julie:

Based on your query, the segment_value is the only value involved in the evaluation of the decile. So, the answer to your question is yes. Equal values will all go into the same decile and therfore, with several seqments having the same value appear in the same decile.

If you do not want this to be the situation, you need to provide tiebreakers in the format of additional sort columns. Lets say for example that each of the segments have a different date and they makes a distinction between them, segment_date becomes a secondary sort of either ASC (default) or DESC as in:

     > Select
     >          Segment
     >          ,quantile(10, segment_value, segment_date DESC)   as Decile
     > from
     >          TableX

This should cause a more even distribution of the data between the 10 categories. If this doesn't obtain enough of a division, add more sort columns using DESC where appropriate.


Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023