Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort a Calculated Dimension

Hi all,

   I have a calculed dimension that is defined as followed:

=if( Estado <>'Pendente', null(),

(if((([Data Hoje] - ([Data Emissão])) /7)<1 , '< 1 Semana',

if((([Data Hoje] - ([Data Emissão])) /7)>=1 and (([Data Hoje] - ([Data Emissão])) /7)<2 , '1 Semana',

if((([Data Hoje] - ([Data Emissão])) /7)>=2 and  (([Data Hoje] - ([Data Emissão])) /7)<3, '2 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=3 and  (([Data Hoje] - ([Data Emissão])) /7)<4, '3 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=4 and  (([Data Hoje] - ([Data Emissão])) /7)<5, '4 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=5 and  (([Data Hoje] - ([Data Emissão])) /7)<6, '5 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=6 and  (([Data Hoje] - ([Data Emissão])) /7)<7, '6 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=7 and  (([Data Hoje] - ([Data Emissão])) /7)<8, '7 Semanas',

if((([Data Hoje] - ([Data Emissão])) /7)>=8 and (([Data Hoje] - ([Data Emissão])) /7)<9, '8 Semanas',

'> 9 Semanas')))))))))))

   Now I want to sort the data in the chart by the same order as it's defined, but obviously there isn't the option load order. Can someone help?

Regards,

André

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Instead of the plain literals in your if statements, like '< 1 Semana', you could use duals: dual('< 1 Semana',0) to dual('>= 9 Semanas',9).

Duals have both text and numerical representation of values.

Then use the numerical sort option.

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Instead of the plain literals in your if statements, like '< 1 Semana', you could use duals: dual('< 1 Semana',0) to dual('>= 9 Semanas',9).

Duals have both text and numerical representation of values.

Then use the numerical sort option.

Hope this helps,

Stefan

Not applicable
Author

Hi Stefan,

   Thanks for your help, that's the correct answer indeed. Didn't know that this was possible.

Thanks,

André