0
0
Power BIbi_tool~8 mins

SELECTEDVALUE and HASONEVALUE in Power BI - Dashboard Guide

Choose your learning style9 modes available
Dashboard Mode - SELECTEDVALUE and HASONEVALUE
Business Question

Which product category is selected, and what is the total sales for that category? If no single category is selected, show a message to select one.

Sample Data
Order IDProduct CategorySales Amount
1001Electronics200
1002Clothing150
1003Electronics300
1004Furniture400
1005Clothing100
1006Furniture250
Dashboard Components
  • KPI Card: Selected Category
    Formula:
    Selected Category = SELECTEDVALUE('Sales'[Product Category], "Select one category")
    Shows the product category selected or a prompt if none or multiple are selected.
  • KPI Card: Total Sales for Selected Category
    Formula:
    Total Sales Selected = IF(HASONEVALUE('Sales'[Product Category]), SUM('Sales'[Sales Amount]), BLANK())
    Shows total sales only if exactly one category is selected.
  • Table: Sales Details
    Shows all sales rows with Order ID, Product Category, and Sales Amount.
Dashboard Layout
+----------------------+----------------------+
| Selected Category KPI | Total Sales KPI      |
+----------------------+----------------------+
|                      Sales Details Table       |
|                                              |
+----------------------------------------------+
Interactivity

A slicer on Product Category lets you select one category at a time.

When you select exactly one category, the Selected Category card shows that category name, and the Total Sales Selected card shows the sum of sales for that category.

If you select none or multiple categories, the Selected Category card shows "Select one category" and the Total Sales Selected card is blank.

The sales details table always shows all rows but can be filtered by the slicer if applied.

Self Check

If you add a filter to select Product Category = Electronics, what do the KPI cards show?

  • Selected Category: Electronics
  • Total Sales Selected: 500 (200 + 300)

If you select multiple categories, what happens?

  • Selected Category: "Select one category"
  • Total Sales Selected: Blank
Key Result
Dashboard shows selected product category and its total sales using SELECTEDVALUE and HASONEVALUE.