>> Download the sample (Power BI)
This sample shows:
(i) The number of customers that bought an initial basket of products, where the products also overlap with another basket of products.
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Product & Customer
Section titled “Measures - Product & Customer”Initial Basket Customers
Section titled “Initial Basket Customers”Initial Basket Customers =CALCULATE ( [No. of Distinct Customers], TREATAS ( VALUES ( 'Initial Basket'[Products] ), Sales_Table[Product] ))No. of Distinct Customers
Section titled “No. of Distinct Customers”No. of Distinct Customers =DISTINCTCOUNT ( Sales_Table[Customer] )Selection Basket Customers
Section titled “Selection Basket Customers”Selection Basket Customers =CALCULATE ( [No. of Distinct Customers], TREATAS ( VALUES ( 'Selection Basket'[Products] ), Sales_Table[Product] ))Total Basket Customers
Section titled “Total Basket Customers”Total Basket Customers =VAR InitialBasket = CALCULATETABLE ( VALUES ( Sales_Table[Customer] ), TREATAS ( VALUES ( 'Initial Basket'[Products] ), Sales_Table[Product] ) )VAR SelectedBasket = CALCULATETABLE ( VALUES ( Sales_Table[Customer] ), TREATAS ( VALUES ( 'Selection Basket'[Products] ), Sales_Table[Product] ) )RETURN COUNTROWS ( INTERSECT ( InitialBasket, SelectedBasket ) )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 ))