Forum Discussion
Jay20024
Helper I
1 year agoCustom horizontal barchart
Hi, For esthetic purpose, I like to create a horizontal stack barchart with values, that looks like a 100% stacked barchart. So i need to calculate the most expensive category, substracting the res...
- 1 year ago
Jay20024 Create a new measure to calculate the total cost for each category.
Create another measure to calculate the GAP.TotalCost = SUM('YourTable'[Cost])
MaxCost = CALCULATE(MAXX(ALL('YourTable'[Category]), [TotalCost]))
GAP = [MaxCost] - [TotalCost]
Add a stacked bar chart to your report.
Drag the Category field to the Axis.
Drag the TotalCost measure to the Values.
Drag the GAP measure to the Values.
Cookistador
Super User
1 year agoHello Jay20024
This measure should return what you need
GAP =
VAR MaxCost = CALCULATE(MAX('Table'[TotalCost]), ALL('Table'))
RETURN
MaxCost - SUM('Table'[TotalCost])
If it is not what you are trying to achieve, let me know 🙂
Jay20024
Helper I
1 year agoAnother way to do it, Many thanks for this feedback