If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
I have a chart which changes the dimension based on a filter dropdown ( By Region, Product, Manager).
When the dimension is Region then sort Ascending by Region.
When other dimensions, then sort Descending by Sales.
How do I achieve this in Sort expression ?
Thanks for your support.
Using this data:
Data:Load * Inline [Region,Product,Manager,SalesR1,P1,M1,100R2,P2,M2,200R3,P3,M3,300R4,P4,M4,400];
Filter:Load * Inline [FilterRegionProductManager];
Disable the sort on all dimensions except for region which is sorted descending. I used this expression: =If(GetFieldSelections(Filter) = 'Region',Match(Region,R4,R3,R2,R1),Sales)
The Match function is reordering the Region.
I have only one dimension column which is changing based on the selection of dimension in the filter( Region , Manager, Product).
If I select Region, then only Region and Sales will be displayed. Sort by Region ASC
If Manager then Manager and Sales. Sort by Sales DESC
If Region then Region and Sales. Sort by Sales DESC
I tried the solution you gave but it did not work.
Data:Load * Inline [Region,Product,Manager,SalesR1,P1,M1,100R2,P2,M2,400R3,P3,M3,300R4,P4,M4,200];
The table dimension is defined as:
=If (GetFieldSelections(Filter) = 'Region',[Region],If(GetFieldSelections(Filter) = 'Manager',[Manager],[Product]))
The sort expression, set to descending:
=If(GetFieldSelections(Filter) = 'Region',Match(Region,'M4','M3','M2','M1'),Sales)