>> Download the sample (Power BI)
This sample shows how:
(i) Cumulative sales compare with cumulative sales from last year
(ii) Cumulative sales compare with the cumulative budget (where an annual budget has been allocated dynamically across different months using a monthly weighting)
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales, Budget, and Calendar Time
Section titled “Measures - Sales, Budget, and Calendar Time”Budget Allocation
Section titled “Budget Allocation”Budget Allocation =VAR DaysinDateContext = COUNTROWS ( Calendar_Table ) //Finds how many dates in date contextVAR DaysinYear = CALCULATE ( COUNTROWS ( Calendar_Table ), ALLEXCEPT ( Calendar_Table, Calendar_Table[Year] ) ) //Finds how many dates within each yearVAR TotalBudget = LOOKUPVALUE ( Budget_Table[Annual Budget], Budget_Table[Year], [Selected Year] ) //Sums up the Total BudgetRETURN ( DaysinDateContext / DaysinYear ) * TotalBudget//Retrieves Budget Allocation over any date contextCumulative Actuals vs Budget
Section titled “Cumulative Actuals vs Budget”Cumulative Actuals vs Budget =[Cumulative Sales] - [Cumulative Budget Allocation]Cumulative Actuals vs LY
Section titled “Cumulative Actuals vs LY”Cumulative Actuals vs LY =[Cumulative Sales] - [Cumulative Sales LY]Cumulative Budget Allocation
Section titled “Cumulative Budget Allocation”Cumulative Budget Allocation =CALCULATE ( [Budget Allocation], FILTER ( ALLSELECTED ( Calendar_Table ), Calendar_Table[Date] <= MAX ( Calendar_Table[Date] ) ))Cumulative Sales
Section titled “Cumulative Sales”Cumulative Sales =VAR CumulativeTotal = CALCULATE ( [Total Sales], FILTER ( ALLSELECTED ( Calendar_Table ), Calendar_Table[Date] <= MAX ( Calendar_Table[Date] ) ) )RETURN IF ( ISBLANK ( [Total Sales] ), BLANK (), CumulativeTotal )Cumulative Sales LY
Section titled “Cumulative Sales LY”Cumulative Sales LY =CALCULATE ( [Total Sales LY], FILTER ( ALLSELECTED ( Calendar_Table ), Calendar_Table[Date] <= MAX ( Calendar_Table[Date] ) ))Selected Year
Section titled “Selected Year”Selected Year =VAR selectedyear = SELECTEDVALUE ( Calendar_Table[Year] )RETURN IF ( ISBLANK ( selectedyear ), "Multiple Years", selectedyear )Total Sales
Section titled “Total Sales”Total Sales =SUMX ( Sales_Table, Sales_Table[Unit Price] * Sales_Table[Quantity] )Total Sales LY
Section titled “Total Sales LY”Total Sales LY =CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( Calendar_Table[Date] ) )Tables
Section titled “Tables”Calendar_Table
Section titled “Calendar_Table”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 ))