Search code examples
powerbidaxstacked-chart

Power BI customized stacked graph


I have a table containing below fields.

Category    Failure %
Car              0.00%
Car              7.45%
Bus              2.45%
Truck           10.34%
Truck           45.45%
Train           60.00%
Bike           120.00%
Bike            76.45%
Car             14.02%
Bike            12.34%
Bike            25.78%
Bike            56.23%
Car             80.45%

I have categorize them based on the failure % range like anything between 0-10% is one range and 10-20% in another range and so on and anything above 100 are all in one range

Category    Failure %       Range
Car              0.00%      0-10
Car              7.45%      0-10
Bus              2.45%      0-10
Truck           10.34%      10-20
Truck           45.45%      40-50
Train           60.00%      50-60
Bike           120.00%      100+
Bike            76.45%      70-80
Car             14.02%      10-20
Bike            12.34%      10-20
Bike            25.78%      20-30
Bike            56.23%      50-60
Car             80.45%      80-90

Now I want to create a Stacked chart, where x-axis has Category and y-axis has Failure % or Range % and stacked with count of each range. It should have count of all 0-10% in Y-axis in that range only, if nothing between 30-40%, 40-50% it shows count as 0 as so on, something like below

enter image description here

For Car as range count between 0-10 is 2 so it should show count 2 in that range, count 1 for 10-20 range so show that count only and has range count 0 for 30-40 then it should show count as 0. I was able to create a graph with count for each category but on Y-axis it is against the total Failure count instead of the Failure % range.

Thanks in advance if anyone can help.


Solution

  • I don't think you can do this with a stacked bar chart. That's because you want display different values on the labels compared to the actual values. For example: the block for 10% is 10 high, but you want to show the value 2. At this moment it's not possible to show different labels other than the actual values.

    May I suggest a different appoach? You can try building the same sort of visual, with a matrix. Not 100% the same, but you get the idea:

    enter image description here