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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
manojk_pbi
Helper III
Helper III

help need in Sorting Stacked Bar charts

Hi Friends,

 

I am looking for a suggestion on adding sort in Stacked bar charts on Legends. Please suggest how this can be achieved. I don't see any option which sorts my data using legends. Attached the sample data on which i tried and also picture how it looks 

my expectation is - chart should be sorted with Type 1  and it's share by desc

Prod 6 

Prod 3

prod 8

Prod 4

Prod 1

prod 2

 

sample :

ProdActualType
prod11757.00Type1
prod12202.00Type2
Prod2244.00Type1
Prod2328.00Type2
Prod32145.00Type1
Prod3458.00Type2
Prod4164.00Type1
Prod4159.00Type2
Prod5206.00Type1
Prod51047.00Type2
Prod63010.00Type1
Prod6133.00Type2
Prod7931.00Type2
Prod8877.00Type1
Prod8592.00Type2

 

manojk_pbi_0-1711963700788.png

 

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Thank you for the mention @lbendlin .  PBI file attached.  Solved it with measures and is therefore dynamic.

Hope this helps.

Ashish_Mathur_0-1712013970890.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur , I will go through the measures and try to replicate in my application.

lbendlin
Super User
Super User

In the regular world a column can only be sorted by itself or by another column, not by a measure.  ( @Ashish_Mathur may know a trick using visual type switching )

 

Even a DAX column will result in a circular reference, so you would need to create that sort column in Power Query.

 

lbendlin_0-1711979270645.png

This of course no longer makes it dynamic.  But it produces the desired result.

 

lbendlin_1-1711979351970.png

 

 

 

 

@Ashish_Mathur , could you provide some suggestions here how can we do in visualization or any other methods

I have already shared my solution.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @lbendlin for your reply. I will try it on my data set. I am just wondering about performance of this query on data when we have large data. Data which i had provided is aggregated and sample. 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors