Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello Everyone!
I am pretty new to the DAX world. I am trying to do get distinct records on multiple columns in DAX query similar to the way I do in SQL. I tried joining two tables based on the model in the Query Designer which gave me the following query.
EVALUATE SUMMARIZECOLUMNS( 'Dim_Products'[SaleCode], 'Dim_Products'[ProducttName], 'Dim_TimeZone'[StartDate], 'Dim_TimeZone'[StartTime], 'Dim_TimeZone'[EndDate], 'Dim_TimeZone'[EndTime], 'Dim_TimeZone'[Variation], "Fact_Sales_Count", [Fact_Sales_Count] )
Running the above is giving duplicate records. How do I just get distinct records from the query iteslf instead of choosing the 'Remove duplicates" option?
Thanks!
My other suggest would be that you don't have to do everything in DAX (and often its better not to). This looks like it might be an operation that could be done as part of your load cycle, so you only load a table with distinct rows into DAX and don't have to transform it there.
Help when you know. Ask when you don't!
Thanks @kentyler ! I was able to achieve what I needed. Just in case if this helps someone in future.
EVALUATE
DISTINCT(
SELECTCOLUMNS('Dim_Products',
'Dim_Products'[SaleCode],
'Dim_Products'[ProducttName],
'Dim_TimeZone'[StartDate],
'Dim_TimeZone'[StartTime],
'Dim_TimeZone'[EndDate],
'Dim_TimeZone'[EndTime],
'Dim_TimeZone'[Variation]))
And, if we need to add a filter:
EVALUATE
DISTINCT(
SELECTCOLUMNS(
FILTER('Dim_Products', 'Dim_Products'[SaleCode] = 123 && ('Dim_Products'[ProducttName] = "ABC" || 'Dim_Products'[ProducttName] = "XYZ" )),
'Dim_Products'[SaleCode],
'Dim_Products'[ProducttName],
'Dim_TimeZone'[StartDate],
'Dim_TimeZone'[StartTime],
'Dim_TimeZone'[EndDate],
'Dim_TimeZone'[EndTime],
'Dim_TimeZone'[Variation]))
Could you post a sample of your data ? SUMMARIZE COLUMNS is supposed to return distinct rows. So if it's not that's curious.
Help when you know. Ask when you don't!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
5 |
User | Count |
---|---|
20 | |
11 | |
10 | |
9 | |
6 |