2 Replies Latest reply on Dec 27, 2016 11:11 PM by Johnson Hwang

# why my calculated field doesn't work

Hi All,

can anybody help me on below calculated field which to categorize the price range. but tableau remind me "cannot mix aggregate and non-aggregate argument with this function", how to realize my requirement to count the No. of record for each quartile. Thanks

IF          [Price]<=MIN ([Price])                                                                                       THEN '≤ Min Value'

ELSEIF [Price]<=PERCENTILE([Price],0.25) AND [Price]> MIN([Price])                       THEN '≤ 25% Quartile'

ELSEIF [Price]<=PERCENTILE([Price],0.50) AND [Price]> PERCENTILE([Price],0.25) THEN '≤ 50% Quartile'

ELSEIF [Price]<=PERCENTILE([Price],0.75) AND [Price]> PERCENTILE([Price],0.50) THEN '≤ 75% Quartile'

ELSE                                                                                                                                       '≤ Max Value'

END

• ###### 1. Re: why my calculated field doesn't work

IF    sum( [Price])<=MIN ([Price])   THEN  '≤ Min Value'

ELSEIF sum( [Price])<=PERCENTILE([Price],0.25) AND sum( [Price])> MIN([Price])   THEN  '≤ 25% Quartile'

ELSEIF sum( [Price])<=PERCENTILE([Price],0.50) AND sum([Price])> PERCENTILE([Price],0.25) THEN  '≤ 50% Quartile'

ELSEIF sum( [Price])<=PERCENTILE([Price],0.75) AND sum([Price])> PERCENTILE([Price],0.50) THEN  '≤ 75% Quartile'

ELSE       '≤ Max Value'

END

• ###### 2. Re: why my calculated field doesn't work

Hi Keerthana,

Thanks a lot, but it cannot fix my issue, I'm trying to categorize unique row level. so can't use sum. do you had any other way?