Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

Sorting for calculated dimension

Hello Experts,

I have a calulated dimension as below which I wanted to sort in a particular sort order 

Expression :

=if( aggr(sum(Sales),Admin_ID)/1000000>=100 and aggr(sum(Sales),Admin_ID)/1000000<=500,'100M - 500M',

IF(aggr(sum(Sales),Admin_ID)/1000000>=50 and aggr(sum(Sales),Admin_ID)/1000000<100,'50M-99.9M',

IF(aggr(sum(Sales),Admin_ID)/1000000>=25 and aggr(sum(Sales),Admin_ID)/1000000<50,'25M-49.9M',

IF(aggr(sum(Sales),Admin_ID)/1000000>=10 and aggr(sum(Sales),Admin_ID)/1000000<25,'10M-24.9M')
)

)
)

Sort otder I want is same as in Expression, but not sure how to write an expression for sorting.

Thanks in advance.

Labels (1)
2 Solutions

Accepted Solutions
brunobertels
Specialist III
Specialist III

hi 

May  be replace value by a dual value using dual function : 

rather than 

'100M - 500M', use  dual('100M - 500M',1) 

'50M-99.9M', dual('50M-99.9M',2)

'25M-49.9M', dual('25M-49.9M',3)

'10M-24.9M' dual('10M-24.9M',4) 

 

View solution in original post

rwunderlich

Create your values using the Dual function, using the sort order as the numeric parm. Example

Dual('100M - 500M', 1)
Dual('50M-99.9M', 2)

Then set your chart Sort option to Numeric.

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

2 Replies
brunobertels
Specialist III
Specialist III

hi 

May  be replace value by a dual value using dual function : 

rather than 

'100M - 500M', use  dual('100M - 500M',1) 

'50M-99.9M', dual('50M-99.9M',2)

'25M-49.9M', dual('25M-49.9M',3)

'10M-24.9M' dual('10M-24.9M',4) 

 

rwunderlich

Create your values using the Dual function, using the sort order as the numeric parm. Example

Dual('100M - 500M', 1)
Dual('50M-99.9M', 2)

Then set your chart Sort option to Numeric.

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com