0
0
Power BIbi_tool~15 mins

COUNT and DISTINCTCOUNT in Power BI - Real Business Scenario

Choose your learning style9 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants to understand how many total sales transactions happened each month and how many unique customers made purchases each month.
📊 Data: You have a sales data table with columns: TransactionID, CustomerID, SaleDate, and Amount.
🎯 Deliverable: Create a report showing for each month the total number of sales transactions and the number of unique customers.
Progress0 / 4 steps
Sample Data
TransactionIDCustomerIDSaleDateAmount
1001C0012024-01-05150
1002C0022024-01-15200
1003C0012024-01-20100
1004C0032024-02-02250
1005C0042024-02-10300
1006C0022024-02-15180
1007C0052024-03-01220
1008C0012024-03-05130
1009C0062024-03-10170
1010C0052024-03-15210
1
Step 1: Create a new column in Power BI to extract the month and year from the SaleDate column.
MonthYear = FORMAT(Sales[SaleDate], "YYYY-MM")
Expected Result
A new column 'MonthYear' with values like '2024-01', '2024-02', '2024-03' for each row.
2
Step 2: Create a measure to count total sales transactions per month.
Total Transactions = COUNT(Sales[TransactionID])
Expected Result
For January 2024: 3, February 2024: 3, March 2024: 4
3
Step 3: Create a measure to count distinct customers per month.
Unique Customers = DISTINCTCOUNT(Sales[CustomerID])
Expected Result
For January 2024: 2, February 2024: 3, March 2024: 3
4
Step 4: Create a table visual in Power BI with MonthYear as rows, and add the two measures: Total Transactions and Unique Customers as values.
Table visual configuration: Rows = MonthYear, Values = Total Transactions, Unique Customers
Expected Result
A table showing each month with total transactions and unique customers counts.
Final Result
MonthYear | Total Transactions | Unique Customers
---------------------------------------------
2024-01   | 3                  | 2
2024-02   | 3                  | 3
2024-03   | 4                  | 3
January had 3 sales transactions from 2 unique customers.
February had 3 sales transactions from 3 unique customers.
March had the highest activity with 4 sales transactions from 3 unique customers.
Bonus Challenge

Create a line chart showing the trend of unique customers over the months.

Show Hint
Use MonthYear on the X-axis and the Unique Customers measure on the Y-axis.