0
0
Power BIbi_tool~15 mins

COUNTROWS 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 know how many sales transactions happened each month to understand sales activity volume.
📊 Data: You have a sales data table with columns: TransactionID, Date, Product, Quantity, and SalesAmount.
🎯 Deliverable: Create a report showing the count of sales transactions per month.
Progress0 / 3 steps
Sample Data
TransactionIDDateProductQuantitySalesAmount
10012024-01-05Shirt240
10022024-01-15Pants150
10032024-02-03Hat330
10042024-02-20Shirt120
10052024-03-10Shoes180
10062024-03-15Shirt240
10072024-03-25Pants150
10082024-04-05Hat220
10092024-04-18Shoes180
10102024-04-22Shirt120
1
Step 1: Create a new calculated column to extract the month and year from the Date column for grouping.
MonthYear = FORMAT('Sales'[Date], "YYYY-MM")
Expected Result
A new column 'MonthYear' with values like '2024-01', '2024-02', etc.
2
Step 2: Create a measure to count the number of sales transactions for each month.
MonthlyTransactionCount = COUNTROWS('Sales')
Expected Result
A measure that counts all rows in the Sales table filtered by the current month context.
3
Step 3: Build a table visual with 'MonthYear' on rows and the 'MonthlyTransactionCount' measure as values.
Configure table visual: Rows = 'Sales'[MonthYear], Values = MonthlyTransactionCount
Expected Result
Table showing each month and the count of transactions: 2024-01 = 2, 2024-02 = 2, 2024-03 = 3, 2024-04 = 3
Final Result
MonthYear | Transactions
------------------------
2024-01   | 2
2024-02   | 2
2024-03   | 3
2024-04   | 3
January and February each had 2 sales transactions.
March and April had higher sales activity with 3 transactions each.
Sales volume increased in March and April compared to the first two months.
Bonus Challenge

Create a measure to count only transactions where Quantity is greater than 1 for each month.

Show Hint
Use COUNTROWS with FILTER to count rows where 'Sales'[Quantity] > 1.