0
0
Power BIbi_tool~15 mins

IF function for conditions 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 classify each sale as 'High Value' or 'Regular' based on the sale amount. Sales above $500 should be labeled 'High Value', others as 'Regular'.
📊 Data: You have a sales dataset with columns: Sale ID, Product, Sale Amount, and Date.
🎯 Deliverable: Create a new column in Power BI using the IF function to classify sales, then build a simple table visual showing Sale ID, Sale Amount, and the new classification.
Progress0 / 4 steps
Sample Data
Sale IDProductSale AmountDate
101Headphones4502024-05-01
102Smartphone7002024-05-02
103Laptop12002024-05-03
104Charger502024-05-04
105Tablet3002024-05-05
106Monitor5502024-05-06
107Keyboard802024-05-07
108Mouse402024-05-08
1
Step 1: Open Power BI Desktop and load the sales data table.
No formula needed for this step.
Expected Result
Sales data table is loaded and visible in the Fields pane.
2
Step 2: Create a new calculated column to classify sales using the IF function.
Sales Classification = IF('Sales'[Sale Amount] > 500, "High Value", "Regular")
Expected Result
A new column 'Sales Classification' is added with values 'High Value' for sales above 500 and 'Regular' otherwise.
3
Step 3: Create a table visual on the report canvas.
Add fields: Sale ID, Sale Amount, Sales Classification to the table visual.
Expected Result
Table shows each sale with its amount and classification.
4
Step 4: Format the table for readability: adjust column widths and enable word wrap if needed.
Use the Format pane to adjust visual settings.
Expected Result
Table is clear and easy to read.
Final Result
-----------------------------------------
| Sale ID | Sale Amount | Classification |
-----------------------------------------
| 101     | 450         | Regular       |
| 102     | 700         | High Value    |
| 103     | 1200        | High Value    |
| 104     | 50          | Regular       |
| 105     | 300         | Regular       |
| 106     | 550         | High Value    |
| 107     | 80          | Regular       |
| 108     | 40          | Regular       |
-----------------------------------------
Sales above $500 are correctly labeled as 'High Value'.
Most sales are 'Regular' with amounts $500 or less.
This classification helps quickly identify important sales.
Bonus Challenge

Create a measure that counts how many 'High Value' sales occurred.

Show Hint
Use the COUNTROWS and FILTER functions together, like: HighValueCount = COUNTROWS(FILTER('Sales', 'Sales'[Sale Amount] > 500))