Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Ja123__
Partner - Creator
Partner - Creator

Ordering of Chart. Dimension is a calculated column.

Hi Everyone

I'm having trouble sorting a bar chart. It's the only one on my model that isn't sorted properly.

Image.PNG

The calculation for Salary Bracket is below. I have tried using the same expression with a if < 1000,1 etc. (Replacing the salary brackets texts below with a number to order but that method didn't seem to work.

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

< 1000, 'Under 1K/Null',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

<= 50000,            '1K - 50K',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

<= 250000,          '50K - 250K',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

<= 500000,          '250K - 500K',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

<= 750000,          '500K - 750K',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

<= 1000000,       '750K - 1000K',

 

if(

Aggr(   {< dteEffectiveDate8 = {"<=$(vEndDate)"} >}      FirstSortedValue(numAnnualSalary , - dteEffectiveDate8 ) , MemberID )

> 1000000,          '1000K +',

 

'Under 1K/Null' )))))))

 

1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi James,

Instead of returning only '1K - 50K', you can return a dual function. This will give you the option for an extra value, on to sort on.

Dual('1K-50K',2)

Do this for all your returned values and place them in the order you want. So start with 1, then 2 and so on. Now you can sort on this value in the Sorting part.

Jordy

Climber

Work smarter, not harder

View solution in original post

2 Replies
JordyWegman
Partner - Master
Partner - Master

Hi James,

Instead of returning only '1K - 50K', you can return a dual function. This will give you the option for an extra value, on to sort on.

Dual('1K-50K',2)

Do this for all your returned values and place them in the order you want. So start with 1, then 2 and so on. Now you can sort on this value in the Sorting part.

Jordy

Climber

Work smarter, not harder
Ja123__
Partner - Creator
Partner - Creator
Author

Thanks Jordy! Works perfectly!