Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
How can I calculate the measure to show the percentage of each category with total 100% each month, not 100% over the time period?
For example, here is the chart with top 5 categories
when I convert the data into the percentage, they shows the percentage of each category as 100% total over all time, but I want to show percentage of total in each month.
Yes, I can use 100% stacked column chart, but I need the line chart in this case. Is it possible? even I have to do some extra measure fields or columns
Thanks,
Solved! Go to Solution.
Hi @dnguyen67 ,
I created some dummy data based on your screenshots and made a solution.
Sample data:
I reproduced your outputs.
Now here's my solution.
1.Create a month column, a year column and a sort column.
Month = FORMAT([Date],"MMM")
Year = YEAR([Date])
sort = MONTH([Date])
2.Sort the month column by the sort column.
3.Create a measure to calculate the percentage by category per month.
Percentage =
VAR _sum =
SUM ( 'Table'[Value] )
VAR _totalpermonth =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
[Year] = MAX ( 'Table'[Year] )
&& [Month] = MAX ( 'Table'[Month] )
)
)
RETURN
DIVIDE ( _sum, _totalpermonth )
4.Here's the expected output.
You can check more details from my attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @dnguyen67 ,
I created some dummy data based on your screenshots and made a solution.
Sample data:
I reproduced your outputs.
Now here's my solution.
1.Create a month column, a year column and a sort column.
Month = FORMAT([Date],"MMM")
Year = YEAR([Date])
sort = MONTH([Date])
2.Sort the month column by the sort column.
3.Create a measure to calculate the percentage by category per month.
Percentage =
VAR _sum =
SUM ( 'Table'[Value] )
VAR _totalpermonth =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
[Year] = MAX ( 'Table'[Year] )
&& [Month] = MAX ( 'Table'[Month] )
)
)
RETURN
DIVIDE ( _sum, _totalpermonth )
4.Here's the expected output.
You can check more details from my attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Try this measure
=divide([Total sales],calculate([Total sales],allselected(Data[Category])))
If this does not work, then share the link from where i can download your PBI file.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
99 | |
69 | |
46 | |
39 | |
33 |
User | Count |
---|---|
163 | |
110 | |
61 | |
51 | |
40 |