Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
anonymous_thr
Regular Visitor

Creating Data Visualization sorted by combination of y-axis values

I currently have a stacked column chart with three aggregate values in the y-axis. Is it possible for me to sort by the combination of all three of these values? Currently, the sorting options only seem to allow for me to sort by one of these values, but I'm looking for a way to do all three. 

1 ACCEPTED SOLUTION

Hi @anonymous_thr 

In the first step create measures for your segments (instead of just dragging and dropping the columns)

Ritaf1983_3-1689960352012.png

 


for example = 

Cross_Sales = sum('financials'[Cross sales])


After you have 3 measures of segments, you should summarize them with new Dax measure :
sum_segments = [Measure_11]+[Measure_12]+[Measure_13]

than on X-Axis you need to put your categories :
on Y-Axis - 3 measures of segments.
on tooltip sum_segments
Ritaf1983_0-1689959715413.png

Result you can sort your columns by Sum_measures or by separate segment according to your needs:
Example of sorting by segment:

Ritaf1983_1-1689959831858.png

Example of sorting by sum_messures:

Ritaf1983_2-1689959997170.png

Sample linked file updated too: Link to the updated file 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

View solution in original post

7 REPLIES 7
Ritaf1983
Super User
Super User

Hi @anonymous_thr 
Please show some example of your data and desired result

I can't do a screenshot of my data for obvious reasons, but as an example: see the below graph. It's  a stacked column chart. Imagine the values are different - I want to sort the table by the actual stacked columns themselves, not just a singular value. Typically, the only way I can see Excel sorting working is by sorting one value, not all the values that are stacked together. I essentially want a stacked column chart that operates by having a descending visual, so that the highest stacked bar is first, second highest is second etc. Ex.png

Hi @anonymous_thr 
I am still not sure that I understood your needs, so I will try to show all sorting options.
First of all, this is just 1 hierarchy of sorts, you can't combine them ( unlike the table).

If you want to sort them by "total" column is the basic : 

Ritaf1983_0-1689913565463.png

if you need to sort by "column pieces" you need to create separate measures for every part of the legend for example :

Measure_11 = CALCULATE(SUM('Table'[value]),'Table'[subcategory]=11)
And put those measures on y-axis:
Ritaf1983_1-1689913903269.png

And if you want to choose which option to sort you can combine the first with the second using tooltips:

Ritaf1983_2-1689914040540.png

Link to sample file with all 3 versions 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 



 

Thanks for the help. In my case though, I don't have the values in legend. I have them all as separate y values as shown below. Is there a way I can sort them in this format? To be clear, I want them to be sorted the way you have it in your first sorting example, but I don't have these all distinguished in a legend.

Ex2.png

Yes.

like on third option.

Create dax for sumiirization of all of your segments and put it on tooltip 

Sorry, could you explain to me how to do that? You're saying to put all three y-values into a single y-value, but I don't really know how that works. I'm fairly new to Power BI.

Hi @anonymous_thr 

In the first step create measures for your segments (instead of just dragging and dropping the columns)

Ritaf1983_3-1689960352012.png

 


for example = 

Cross_Sales = sum('financials'[Cross sales])


After you have 3 measures of segments, you should summarize them with new Dax measure :
sum_segments = [Measure_11]+[Measure_12]+[Measure_13]

than on X-Axis you need to put your categories :
on Y-Axis - 3 measures of segments.
on tooltip sum_segments
Ritaf1983_0-1689959715413.png

Result you can sort your columns by Sum_measures or by separate segment according to your needs:
Example of sorting by segment:

Ritaf1983_1-1689959831858.png

Example of sorting by sum_messures:

Ritaf1983_2-1689959997170.png

Sample linked file updated too: Link to the updated file 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.