Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
jijig90
Contributor II
Contributor II

Sorting stacked bar in Qlik Sense with measure market share

Hello community,

I am facing an issue with sorting stacked bars in Qlik Sense. I would appreciate any guidance or suggestion. Each bar represents a year, and within each bar, there are segments that represent different values. The bars and their segments are not sorting as expected.

I have used the expression bellow for the measure "PDM":

if( GetSelectedCount([subCategory])=0 and GetSelectedCount([Category])=0 ,
Sum({$<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'}, Category=p(Category), [subCategory]=p([subCategory])>} Amount)
/
Sum({1<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'}>} total <year> Amount)
,
if ( GetSelectedCount([Category])>0 and GetSelectedCount([subCategory])=0 ,
Sum({$<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'}, Category=p(Category)>} Amount)
/
Sum({1<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'},Category=p(Category)>} total <year> Amount)
,
Sum({$<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'}, Category=p(Category), [subCategory]=p([subCategory])>} Amount)
/
Sum({1<year = {">=$(=max(year)-3)<=$(=max(year))"}, Source = {'SRC'},Category=p(Category), [subCategory]=p([subCategory])>} total <year> Amount)
))

The data visualized on the stacked bar chart looks like this:

jijig90_1-1698670908071.png

 

I need to sort the segments (here company) for each year while maintaining a fixed color code for each company.

Labels (1)
3 Replies
kaushi2020
Creator II
Creator II

Try creating a master Dimension

kaushi2020_0-1698673246063.png

 

Then go to the edit dimension property and click on VALUE COLOURS option 

kaushi2020_1-1698673319030.png

Here you can try to put colors based on your requirements for the company.  Further call this dimension name in the Dimension section. you will see custom colors for the company.

kaushi2020_2-1698673359362.png

tried sorting via below sort option but seems its not happening. :S 

kaushi2020_3-1698673879089.png

 

jijig90
Contributor II
Contributor II
Author

@kaushi2020  Thanks for the help about the dimension color. As u can see, the sorting still doesn't work

kaushi2020
Creator II
Creator II

May be some issues with the version which we are using. I am also awaiting for experts to revert on the sorting. Seems this is unusual behaviour.

#Support