What if you could instantly see all unique customers without digging through endless rows?
Why VALUES and DISTINCT in Power BI? - Purpose & Use Cases
Imagine you have a huge sales list in a spreadsheet with many repeated customer names. You want to find all unique customers to send a special offer. Doing this by scanning and copying each name manually is tiring and confusing.
Manually filtering unique values takes a lot of time and is easy to mess up. You might miss some names or accidentally include duplicates. It's hard to keep track when the list changes often.
Using VALUES or DISTINCT in Power BI automatically picks out unique items from your data. It updates instantly when your data changes, so you always get the right list without extra work.
Filter each name by hand and copy unique onesUniqueCustomers = DISTINCT(Sales[CustomerName])
You can quickly create reports and visuals that focus on unique entries, making your insights clearer and your work faster.
A marketing team uses DISTINCT to list all unique product categories sold last month, helping them target promotions effectively without missing any category.
Manually finding unique values is slow and error-prone.
VALUES and DISTINCT automatically extract unique items from data.
This makes reports accurate, dynamic, and easy to update.
Practice
VALUES and DISTINCT?Solution
Step 1: Understand
VALUESbehaviorVALUESreturns unique values from a column and includes blank values if they exist.Step 2: Understand
DISTINCTbehaviorDISTINCTreturns unique values but excludes blank values from the result.Final Answer:
VALUESincludes blanks,DISTINCTexcludes blanks -> Option AQuick Check:
VALUES includes blanks, DISTINCT excludes blanks [OK]
- Thinking VALUES and DISTINCT always return the same results
- Assuming DISTINCT includes blanks
- Confusing the behavior of blank values in both functions
Product[Category] using DISTINCT?Solution
Step 1: Check correct column reference syntax
In DAX, columns are referenced with table name and column name inside square brackets, likeProduct[Category].Step 2: Check function syntax
BothVALUESandDISTINCTtake a column reference in parentheses. The correct syntax isDISTINCT(Product[Category]).Final Answer:
DISTINCT(Product[Category]) -> Option AQuick Check:
Correct syntax uses square brackets and function call [OK]
- Using dot notation instead of square brackets
- Missing parentheses after function name
- Using incorrect column references
Sales with a column CustomerID containing values [1, 2, 2, 3, BLANK, 3], what will be the result of COUNTROWS(VALUES(Sales[CustomerID]))?Solution
Step 1: Identify unique values including blanks
The unique values inCustomerIDare 1, 2, 3, and BLANK. That is 4 unique values.Step 2: Apply
COUNTROWSonVALUESVALUESreturns unique values including blanks, soCOUNTROWScounts 4 rows.Final Answer:
4 -> Option CQuick Check:
Unique values including blank = 4 [OK]
- Ignoring blank values in count
- Counting duplicates multiple times
- Confusing DISTINCT behavior here
UniqueProducts = DISTINCT(Product[ProductName]). When you use it in a card visual, it shows an error. What is the problem?Solution
Step 1: Understand what DISTINCT returns
DISTINCTreturns a table of unique values, not a single number or scalar value.Step 2: Understand card visual requirements
Card visuals require a single scalar value, like a number or text, not a table.Final Answer:
DISTINCT returns a table, but card visuals need a single value. -> Option BQuick Check:
DISTINCT returns table, card needs scalar [OK]
- Using DISTINCT directly in measures for visuals needing scalars
- Incorrect column references
- Thinking DISTINCT returns a number
Customers[Name] column. Which DAX expression should you use to create a calculated table for this slicer?Solution
Step 1: Understand the need to exclude blanks
BothVALUESandDISTINCTreturn unique values, butVALUESincludes blanks whileDISTINCTexcludes them.Step 2: Choose function and filter blanks
DISTINCTreturns unique values excluding blanks, which is perfect for a slicer.Step 3: Compare options
CustomerNames = DISTINCT(Customers[Name])directly provides unique non-blank names without needing extra filtering.Final Answer:
CustomerNames = DISTINCT(Customers[Name]) -> Option DQuick Check:
DISTINCT excludes blanks for clean slicer [OK]
- Using VALUES without filtering blanks
- Assuming DISTINCT includes blanks
- Using incorrect column references in FILTER conditions
Ready to prove it?
Pass the test and this pattern moves unknown
