Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WorkHard
Helper V
Helper V

Create table with unique values from one column but bring the other columns as well

Everyone knows how to create a table of distinct values from multiple columns but how about creating a table based on the distinct values of a single column?

The below formula creates a distinct table as needed but if an eventID had multiple regions it will still create multiple rows of the same eventID.

How do I change the DAX so that no matter what the eventID can only be pulled once (FIRST)?

NewTable = distinct(SELECTCOLUMNS('MyTable',"eventID",'MyTable'[eventID],"Region",'MyTable'[Region]))

 

1 ACCEPTED SOLUTION

@WorkHard 

 

I tested this. This should works. Could you please provide screenshot or sample data?

1.PNG

Table = SUMMARIZE(Mytable,Mytable[eventid],"region",min(Mytable[region]))

2.PNG 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@WorkHard , Try like

NewTable =summarize('MyTable','MyTable'[Region],"eventID" ,min('MyTable'[eventID]))
or //when you min region
NewTable =summarize('MyTable','MyTable'[eventID],"Region" ,min('MyTable'[Region]))

the min() method gives me a "Parameter is not the correct type". Both columns are type string.

@WorkHard 

 

I tested this. This should works. Could you please provide screenshot or sample data?

1.PNG

Table = SUMMARIZE(Mytable,Mytable[eventid],"region",min(Mytable[region]))

2.PNG 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@WorkHard 

 

have you tried summarized?

table = summarized('MyTable',"eventID",'MyTable'[eventID],"Region",'MyTable'[Region])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Yes, summarize does the same thing, it will still duplicate the event ID.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.