Skip to content

Cumulative Sales, using ALLEXCEPT, to ensure no resetting of Start Date

>> Download the sample (Power BI)

This sample shows cumulative sales, using ALLEXCEPT, so that the cumulative calculation does not reset from the original start date.

Cumulative Revenue =
CALCULATE (
[Total Revenue],
FILTER (
ALLEXCEPT ( Calendar_Table, Calendar_Table[Week No] ),
Calendar_Table[Date] <= MAX ( Calendar_Table[Date] )
)
)
Max Sales by Product by Region =
VAR ProductRegions =
GROUPBY (
Sales_Table,
Products_Table[Products],
Region_Table[Region],
"Sales", SUMX ( CURRENTGROUP (), Sales_Table[Quantity] * Sales_Table[Unit Price] )
)
RETURN
MAXX ( ProductRegions, [Sales] )
Total Revenue =
SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )
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 )
)