Skip to content

Calculating Dynamic % of Totals

>> Download the sample (Power BI)

This sample shows the revenue for each product as a % of total sales for all products.

% of Total Revenue =
DIVIDE (
[SUMX Total Sales],
CALCULATE ( [SUMX Total Sales], ALL ( Products_Table ) ),
BLANK ()
)
SUMX Total Sales =
SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )
Yearly Diff. % of Total Revenue =
IF (
CALCULATE ( [% of Total Revenue], DATEADD ( Calendar_Table[Date], -1, YEAR ) ) = 0,
BLANK (),
[% of Total Revenue]
- CALCULATE ( [% of Total Revenue], DATEADD ( Calendar_Table[Date], -1, YEAR ) )
)
Calendar_Table =
GENERATE (
CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2019, 12, 31 ) ),
VAR currentDay = [Date]
VAR Day =
DAY ( currentDay )
VAR Month =
MONTH ( currentDay )
VAR Year =
YEAR ( currentDay )
RETURN
ROW ( "Day", day, "Month", month, "Year", year )
)