Forum Discussion
Creating a visual with measures
- 1 year ago
Hi pter14 ,
1.Create a Single Measure for Category Share
Instead of creating individual measures for each category, you can use a single dynamic measure:
Category Share = DIVIDE( SUM('Table'[Quantity]), CALCULATE(SUM('Table'[Quantity]), ALL('Table'[Category])) )
This formula calculates the share of each category’s quantity out of the total quantity dynamically.2.Use a Stacked Column Chart
- Add Category to the Axis of the visual.
- Add the Category Share measure to the Values.
- Format the visual to display percentage values.
3. Add Tooltips (Optional)
To enhance the visual:
Include additional details in the tooltip, like the total quantity or the raw value for each category, using separate measures.
Please mark this as solution if it helps yopu. Appreciate Kudos.
Hi pter14 ,
1.Create a Single Measure for Category Share
Instead of creating individual measures for each category, you can use a single dynamic measure:
Category Share = DIVIDE( SUM('Table'[Quantity]), CALCULATE(SUM('Table'[Quantity]), ALL('Table'[Category])) )
2.Use a Stacked Column Chart
- Add Category to the Axis of the visual.
- Add the Category Share measure to the Values.
- Format the visual to display percentage values.
3. Add Tooltips (Optional)
To enhance the visual:
Include additional details in the tooltip, like the total quantity or the raw value for each category, using separate measures.
Please mark this as solution if it helps yopu. Appreciate Kudos.
- pter141 year agoFrequent Visitor
Hello FarhanJeelani,
Thank you for the quick solution, unfortunately this is not working for me.
Category Share = DIVIDE( SUM('Table'[Quantity]), CALCULATE(SUM('Table'[Quantity]), ALL('Table'[Category])) ) This formula gives back 100% for all of the categories, and I felt like the numerator and denominator are switched, so i tried:Category Share = DIVIDE(CALCULATE(SUM('Table'[Quantity]), ALL('Table'[Category])), SUM('Table'[Quantity]))
This 2nd one I have to divide by 100 and it gives me back percentages, but not the right percentages.
Maybe I am doing something wrong, or you need more clarficiation on the data? - pter141 year agoFrequent Visitor
Dear FarhanJeelani,
Maybe a filter was on, or I dont know, but it looks like it is working now. Thank you for your assist. Could you please clarify what went wrong on my thinking?