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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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