Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
2 like 0 dislike
4.2k views
in Power BI by 1 1 2
edited by

I am developing a new report using Power BI, By default, the bar chart is sorted by the max value also I can sort the bar chart ascending and descending but I need to perform power bi custom sort bar chart in custom order

In this example, I want to change the sort of stacked bar chart to be (Low, Medium, High) instead of sorting ascending or descending per axis name or value. (High, Low, Medium).

power bi custom sort bar chart in custom order

How can I change the order of Axis of stacked bar chart in Power BI and How to create custom sorting in Power BI Bar chart?

by
0 0
Which order you need
by 1 1 3
0 0
Create a lookup table and try to link it with relation!

1 Answer

0 like 0 dislike
by 163 204 403
edited by

Power BI Custom sorting order Bar Chart

  • At "Home", Click on Enter Data to create a Temp table for your status table.
    enter data samples in power bi
  • Add two columns, one for ID and one for the same corresponding value of your status column.
    create a status tabe in power BI
  • In the Model section, Make sure that the main table has a relation with your new status table with the status column as shown below:
    create a relation in Power BI
  • In the Data section, sort the status column with the ID column.
    sort by column in Power BI
  • Now, add the status column of the new table in Axis, and drag the count in the values.
    power bi custom sorting order bar chart
    Output

power bi custom sort order bar chart

Show items with no data as a Zero in Power BI

The above solution would work properly if all Axis has values. but if there are no rows with a High value (count of rows is ZERO), so the bar for a high value will not be shown in the bar chart as shown below:
power bi bar chart does not show zero bar

So, to avoid this issue and show a bar chart with zero Axis value, you should do the following:

  • Create a measure to calculate the count.
    Show bar chart with zero value in Power BI
  • Set the Axis and the value as shown below
    power bi custom sorting order stacked bar chart

Output
Power BI Show bar chart with zero value
power bi showing a bar chart with zero value


Download

If you don’t ask, the answer is always NO!
...