>> Download the sample (Power BI)
This sample shows, for each customer:
(i) The total number of transacting days
(ii) The number of transactions made each quarter over the past year
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales & Calendar Time
Section titled “Measures - Sales & Calendar Time”Date of First Purchase
Section titled “Date of First Purchase”Date of First Purchase =FIRSTDATE ( Sales_Table[Date] )Date of Last Purchase
Section titled “Date of Last Purchase”Date of Last Purchase =LASTDATE ( Sales_Table[Date] )Date of Last Purchase v2
Section titled “Date of Last Purchase v2”Date of Last Purchase v2 =LASTNONBLANK ( Calendar_Table[Date], [Total Sales] )Last Purchase Date of All Sales
Section titled “Last Purchase Date of All Sales”Last Purchase Date of All Sales =MAXX ( ALL ( Sales_Table[Date] ), Sales_Table[Date] )No. of Distinct Customers
Section titled “No. of Distinct Customers”No. of Distinct Customers =DISTINCTCOUNT ( Sales_Table[Customer] )Total Sales
Section titled “Total Sales”Total Sales =SUMX ( Sales_Table, Sales_Table[Unit Price] * Sales_Table[Quantity] )Total Transacting Days
Section titled “Total Transacting Days”Total Transacting Days =DISTINCTCOUNT ( Sales_Table[Date] )Transactions in Last 92 Days
Section titled “Transactions in Last 92 Days”Transactions in Last 92 Days =CALCULATE ( COUNTROWS ( Sales_Table ), FILTER ( ALL ( Calendar_Table ), Calendar_Table[Date] > [Last Purchase Date of All Sales] - 92 && Calendar_Table[Date] <= [Last Purchase Date of All Sales] ))Transactions in Last 183 Days
Section titled “Transactions in Last 183 Days”Transactions in Last 183 Days =CALCULATE ( COUNTROWS ( Sales_Table ), FILTER ( ALL ( Calendar_Table ), Calendar_Table[Date] > [Last Purchase Date of All Sales] - 183 && Calendar_Table[Date] <= [Last Purchase Date of All Sales] ))Transactions in Last 275 Days
Section titled “Transactions in Last 275 Days”Transactions in Last 275 Days =CALCULATE ( COUNTROWS ( Sales_Table ), FILTER ( ALL ( Calendar_Table ), Calendar_Table[Date] > [Last Purchase Date of All Sales] - 275 && Calendar_Table[Date] <= [Last Purchase Date of All Sales] ))Transactions in Last 366 Days
Section titled “Transactions in Last 366 Days”Transactions in Last 366 Days =CALCULATE ( COUNTROWS ( Sales_Table ), FILTER ( ALL ( Calendar_Table ), Calendar_Table[Date] > [Last Purchase Date of All Sales] - 366 && Calendar_Table[Date] <= [Last Purchase Date of All Sales] ))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 ))