What is the difference between Distinct() and Values() in DAX
Loading
What is the difference between Distinct() and Values() in DAX
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted Jan 1, 2025, 10:01 AM EST
In DAX (Data Analysis Expressions),
1. DISTINCT()DISTINCT()andVALUES()are two functions that seem similar at first glance but have key differences in behavior and use cases.-
-
- Removes duplicates from the specified column or table expression.
- Always returns a table with the distinct values, regardless of the current filter context.
-
- To calculate unique values in a dataset.
- Useful in aggregation and when filtering operations need to consider distinct values.
-
Code
2. VALUES()Purpose: Returns a one-column table that contains the unique values from a specified column or expression.
Behavior:
Typical Use Cases:
Example:
This returns a table of all unique products in the
Salestable.-
-
- If there is a filter applied to the column,
- If no filter is applied, it behaves similarly to
- If all rows in the column are blank, it returns an empty table.
- If the entire column is filtered out, it returns a blank value (different from
-
- To retrieve values affected by the filter context.
- Often used in relationship calculations, measures, or scenarios where filter context sensitivity is required.
-
Code
Key DifferencesPurpose: Returns a one-column table of unique values for a column, but it respects the current filter context.
Behavior:
VALUES()returns only the unique values visible under that filter.DISTINCT().DISTINCT).Typical Use Cases:
Example:
This returns the unique regions in the
Salestable, but only those visible in the current filter context.DISTINCT()when you want the global unique values, regardless of any filters in place.VALUES()when you need to work within the current filter context and account for filters applied to the data.Rajeesh MenothRank #118 · 18.4K reputationPosted Jan 1, 2025, 12:46 AM EST
Hi Kiran,
As per the microsoft docs :
The DISTINCT function allows a column name or any valid table expression to be its argument but the VALUES function only accepts a column name or a table name as the argument.
Reference :
https://learn.microsoft.com/en-us/dax/values-function-dax