Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
dnguyen67
Frequent Visitor

How to calculate and show the 100% percentage of each category in each month

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

dnguyen67_1-1651528073495.png

 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.

dnguyen67_0-1651527996545.png

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,

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dnguyen67 ,

 

I created some dummy data based on your screenshots and made a solution.

Sample data:

vstephenmsft_0-1651717513384.png

I reproduced your outputs.

vstephenmsft_1-1651717564692.png

vstephenmsft_2-1651717578577.png

 

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])

vstephenmsft_3-1651717758336.png

 

2.Sort the month column by the sort column.

vstephenmsft_4-1651717779563.png

 

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.

vstephenmsft_5-1651717888019.png

 

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @dnguyen67 ,

 

I created some dummy data based on your screenshots and made a solution.

Sample data:

vstephenmsft_0-1651717513384.png

I reproduced your outputs.

vstephenmsft_1-1651717564692.png

vstephenmsft_2-1651717578577.png

 

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])

vstephenmsft_3-1651717758336.png

 

2.Sort the month column by the sort column.

vstephenmsft_4-1651717779563.png

 

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.

vstephenmsft_5-1651717888019.png

 

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.

Anonymous
Not applicable

This one helped my use case. I have had a similar problem where I was calculating the percent of the total per category (stream), where I wanted each category (each stream) to maintain 100% and its products to be a percent of the total per stream.

Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.