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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Creating a percent of total measure

Hello,

 

MATRIX:

       Rows: [Category], [Range of Units Sold]

       Columns: [Date]

       Values: [# Sold], [Revenue 000's], [% of total]

 

I am trying to create a matrix that includes sales information for 3 types of products. I created a measure for "# sold", "Revenue 000's", and now I am trying to create a measure for the revenue of products sold (shown in matrix) by month divided by the overall total revenue for that month. Assume there is data outside of the 3 categories shown in the matrix, but all data still contributes to the total revenue for that month.

 

The DAX I am currently trying to use is found below. To summerize the meaure I would like to create: (Total [Revenue] for each [Range of Units Sold] per [Category] per [Date]) / (Total [Revenue] per [Date]) = [% of Total]

 

I have imported 4 tables, 1 table for each month shown in the matrix, which I then apended the 4 months of data into one table. When I try to create the "% of Total" measure, it calulates the same number as "Revenue 000's" which results in "100% of total" most of the time. Please help me with my DAX for the [% of Total] measure. I unfortunately am unable to provide a dataset.

armstd11_2-1680531789360.png

 

VAR _num = CALCULATE(SUM(Table[Revenue]), FILTER(Table, [Date]=[Date]), Filter(Table, [Category]=[Category]), FILTER(Table, [Range of Units Sold]=[Range of Units Sold]))

VAR _denom = CALCULATE(SUM([Revenue]), ALL(Table[Revenue]), FILTER(Table, [Date]=[Date]))

RETURN
CALCULATE(DIVIDE(_num, _denom)), FILTER(Table, [DATE]=[DATE]))

 

 

 

3 REPLIES 3
MohammadLoran25
Solution Sage
Solution Sage

Hi @Anonymous ,

Assuming you have a date table connected to your Table, I think what you need is as below:

 

 

% of Total =
DIVIDE (
    SUM ( 'Table'[Revenue] ),
    CALCULATE (
        [RevenueMeasure],
        FILTER (
            ALL ( DateTable ),
            DateTable[MonthName] = MAX ( DateTable[MonthName] )
        ),
        ALLSELECTED ( 'Table'[Category] ),
        ALLSELECTED ( 'Table'[Range of Units Sold] )
    )
)

 

 

Of course it is better to use YearMonth instead of MonthName in your measure.

 

If this answer solves your problem, please mark it as an accepted solution and gives it a thumbs up so the others would find what they need easier.

 

Regards,

Loran

Anonymous
Not applicable

Thank you for your response!

 

This seems much closer to the result I desire, but there is an issue. The DAX is currently making the denominator the sum of the sales per year. I need the sum of sales per category per month/year as the denominator. 

 

Is there a way to SUM the total revenue per category per month/year for the denominator? I have been trying various things with no luck. Let me know if you need me to explain more clearly.

@Anonymous 
Try This:

NEW % of Total =
DIVIDE (
    SUM ( 'Table'[Revenue] ),
    CALCULATE (
        SUMX ( VALUES ( 'Table'[Category] ), [RevenueMeasure] ),
        FILTER (
            ALL ( DateTable ),
            DateTable[MonthName] = MAX ( DateTable[MonthName] )
        ),
        ALLSELECTED ( 'Table'[Range of Units Sold] )
    )
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.