2 Replies Latest reply: Feb 28, 2013 6:46 PM by Leilani Lau

# Sort pie chart legend on calculated dimension

I have a calculated dimension to put records into one of four groups:

=if(PolYears >=1 and PolYears <=4, 'Insured Less Than 5 Years',

if(PolYears >=5 and PolYears <=9, 'Insured 5-9 Years',

if(PolYears >=10 and PolYears <=14, 'Insured 10-15 Years','Insured 15+ Years')))

Is there a way to sort the legend based on the value of the calculated dimension?

Insured Less than 5 Years

Insured 5-9 Years

Insured 10-15 Years

Insured >15 Years

Thanks!

Leilani

• ###### Re: Sort pie chart legend on calculated dimension

Check the sort by expression option in the sort tab

Expression as

=if(PolYears >=1 and PolYears <=4, 1,

if(PolYears >=5 and PolYears <=9, 2,

if(PolYears >=10 and PolYears <=14, 3,4)))

Edit:

Another way is using Dual

=if(PolYears >=1 and PolYears <=4, Dual('Insured Less Than 5 Years', 1),

if(PolYears >=5 and PolYears <=9, Dual('Insured 5-9 Years', 2),

if(PolYears >=10 and PolYears <=14, Dual('Insured 10-15 Years', 3),Dual('Insured 15+ Years', 4))))

Sort by number as Ascending.

Hope it helps

Celambarasan

• ###### Re: Sort pie chart legend on calculated dimension

Thanks Celambarasan!

I had already tried the first method and it did not work. I cut and pasted your reply to make sure it wasn't a typo, but that also did not work. However using Dual did the trick.

Thank you so much!!

Leilani