>> Download the sample (Power BI)
This sample shows:
(i) Total customers per product, this year
(ii) Total customers per product, last year
(iii) The number of customers who bought both this year and last year
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales & Customer
Section titled “Measures - Sales & Customer”Common Customers
Section titled “Common Customers”Common Customers =COUNTROWS ( INTERSECT ( VALUES ( Sales_Table[Customer] ), CALCULATETABLE ( VALUES ( Sales_Table[Customer] ), DATESBETWEEN ( Calendar_Table[Date], MIN ( Calendar_Table[Date] ) - 365, MAX ( Calendar_Table[Date] ) - 365 ) ) ))Prior Year Customers
Section titled “Prior Year Customers”Prior Year Customers =COUNTROWS ( CALCULATETABLE ( VALUES ( Sales_Table[Customer] ), DATESBETWEEN ( Calendar_Table[Date], MIN ( Calendar_Table[Date] ) - 365, MAX ( Calendar_Table[Date] ) - 365 ) ))This Year Customers
Section titled “This Year Customers”This Year Customers =COUNTROWS ( VALUES ( Sales_Table[Customer] ) )Total Sales
Section titled “Total Sales”Total Sales =SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )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 ))