Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
weiw
Contributor II
Contributor II

sort calculated dimension by expression

Hi,

I create a calculated dimension:

floor(aggr (sum (sales),[CustomerID]),100)&'-'&(floor(aggr (sum (sales),[CustomerID]),100)+99)

as a range of sales amount per customer. And put it as dimension in a bar chat.

The dimension would be 0-99,100-199,200-299,....,500-599,...1000-1099,...30000-30099,..., the list would be dynamic

The questions is how to sort this dimension ascending by the value of the range of sales? Thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@weiw  create your dimension with dual() as below. Then in sorting option, sort your dimension numerically ascending or descending

=dual(floor(aggr (sum (sales),[CustomerID]),100)&'-'&(floor(aggr (sum (sales),[CustomerID]),100)+99),
floor(aggr (sum (sales),[CustomerID]),100))

View solution in original post

4 Replies
gomeri
Partner - Creator
Partner - Creator

Hi @weiw ,

you can create a master measure with your formula and then (with adding of dimension) in the bar chart use sort numerically -> ascending

Thanks

Giovanni O. D.
Kushal_Chawda

@weiw  create your dimension with dual() as below. Then in sorting option, sort your dimension numerically ascending or descending

=dual(floor(aggr (sum (sales),[CustomerID]),100)&'-'&(floor(aggr (sum (sales),[CustomerID]),100)+99),
floor(aggr (sum (sales),[CustomerID]),100))

weiw
Contributor II
Contributor II
Author

Spoiler
I also found that solution. Thank you.
weiw
Contributor II
Contributor II
Author

Sorry I clicked the wrong button. I tried this,also tried to use the lower bound of floor function as expression to sort, but not working. I found a solution which is same as the one from Kushal. Thanks.