Forum Discussion
`Power BI Stacked Graph
- 1 year ago
Hi arjun0028
Welcome to the Microsoft Fabric Community Forum.
Regarding the visualization of course enrolments with the Financial Year on the X-axis, Week of the Month as the legend, and enrolment counts on the Y-axis, the issue arises because the data labels are not reflecting the correct percentage distribution within each financial year.
This typically occurs when the DAX measure used does not properly account for the evaluation context of the visual.
Please try the following DAX measure:
Enrolment Percentage = DIVIDE( SUM('Booking Data'[Enrol_Count]), CALCULATE( SUM('Booking Data'[Enrol_Count]), REMOVEFILTERS('Booking Data'[Week of Month]) ) )
Create a chart with the X-axis representing the Financial Year, a legend indicating the Week of the Month, and values based on the new measure 'Enrolment Percentage'. Ensure that the data labels are configured to display either the percentage or the actual value as required.
If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
Thank you for being part of Fabric Community Forum.
Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.
Hi arjun0028 ,
This issue usually happens in Power BI stacked charts when the measure you use for the data labels isn’t being calculated in the right context. If all your data labels show the same value (or percentage), it’s likely that your DAX measure is not taking the correct axis values into account.
How to fix:
- Make sure your measure uses the correct context. For percentage distribution, you can use something like this:
Percentage =
DIVIDE(
COUNTROWS('YourTable'),
CALCULATE(COUNTROWS('YourTable'), ALL('YourTable'[CategoryColumn]))
)- Replace 'YourTable' and 'CategoryColumn' with your actual table and column names.
- Add this measure to your stacked column chart’s “Values” field and use it for data labels.
Extra tip:
If you want the percentage to show per stack, ensure your measure uses REMOVEFILTERS or ALL properly to calculate the total for each group.
Let me know if you need a sample DAX formula for your exact scenario!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
I would require a sample dax. I am trying to get Enrolment Percentage on a stacked column chart where the table is Booking Data and have column Enrol_Count.