Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi All,
I have a measure which calculates the percentage of missing data in a column.
I have added this measure to the bar chart below.
X-Axis - Attribute
Y_Axis - Measure
Legend - Region
What I want is to sort the bars within the regions but I haven't been able to do it
My Measure (Note the measure does perform some filters in the calcs that I left out, That's why it looks repetitive)
Missing Data % =
VAR TotalRows = COUNTROWS('Data')
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE('Data'[Attribute]) = "Attribute 1",
DIVIDE(
CALCULATE(COUNTROWS('Data'), 'Data'[Value] = "Attribute 2"),
TotalRows),
SELECTEDVALUE('Data'[Attribute]) = "Attribute 2",
DIVIDE(
CALCULATE(COUNTROWS('Data'), 'Data'[Value] = "Attribute 2"),
TotalRows),
SELECTEDVALUE('Data'[Attribute]) = "Attribute 3",
DIVIDE(
CALCULATE(COUNTROWS('Data'), 'Data'[Value] = "No Value"),
TotalRows),
SELECTEDVALUE('Data'[Attribute]) = "Attribute 4",
CALCULATE(DIVIDE(
CALCULATE(COUNTROWS('Data'), 'Data'[Value] = "No Value"),
TotalRows2)),
SELECTEDVALUE('Data'[Attribute]) = "Attribute 5",
DIVIDE(
CALCULATE(COUNTROWS('Data'), 'Data'[Value] = "No Value"),
TotalRows),
0 // Default return value if none of the conditions are met
)
Can someone tell me how I can sort the bars withint each region?, I don't want to create a calculated table either as I have several filters on the page that need to be functional
Hi @obriaincian,
May i know has your issue been resolved? If the response provided by the @danextian, @sanalytics, @DataNinja777, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
If yes, kindly accept the useful reply as a solution and give us Kudos. It would be appreciated.
Thank you for your understanding!
Hi @obriaincian,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @obriaincian,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @obriaincian
Sorting the legends by the value within a specific category currently isn't supported. There are workarounds but they aren't perefect. In the screenshot below, Geo column is ranked by Total Revenue. The ranks are then materialized using a disconnected table and then a column from that disconnected table is used in the visual.
The second chart uses small multiples.
Please see the attached sample pbix.
Hello @obriaincian
If you dont have any specific sort criteria the go to the 3 dot of the visual and go to sort the legend option. Below screenshot
if you have any specific sorting condition then go to Power query or your data source and add a sorting column. Use that column for region sorting. Just like below screenshot
Hope it helps
Regards
sanalytics
@sanalytics you are sorting by region, this is not what I want. I want to sort by the bars within each of the regions
Hi @obriaincian ,
Power BI does not allow you to re-sort each region’s bars independently when they share the same X-axis. The chart treats the Attribute field as one set of categories and applies a single sort rule across them (alphabetical or by a single measure). A typical workaround is to use small multiples, where each region becomes its own mini-chart and you can independently sort by “Missing Data %.” For example, you could add a rank measure like “Rank Attribute = RANKX(ALL('Data'[Attribute]), [Missing Data %], [Missing Data %], DESC)” and then sort each small multiple by this rank measure. Another option is to create a separate visual for each region, then filter the chart to that region and sort by your measure. If you need one single global order (rather than different orders per region), you can create a custom column to specify a sort index, then use “Sort by Column” on that column to define the order of your attributes.
Best regards,
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |