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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JayReidy
Frequent Visitor

Get all values in new columns from duplicate ids

Hey

I have a table that has ID that has up to 5 duplicates. It looks like this

IDLocationCancelledNo showRescheduledTitleDate
1Location 1YesNoYesTitle 11/1/23
2Location 2NoNoNoTitle 21/3/23
1Location 2NoYesNoTitle 312/2/23
1Location 1NoNoNoTitle 413/3/23
2Location 1NoNoNoTitle 52/3/23



In my matrix I want to be able to see

LocationUnique(by earliest)Visited againCancelledNo showRescheduled 
Location 111101 
Location 210010 


I'm having trouble doing this in Power Query or Dax. Any help is appreciated

1 ACCEPTED SOLUTION

@JayReidy 

maybe you can try this

Measure = 
var tbl= FILTER(ADDCOLUMNS('Table',"check",if('Table'[Date]=CALCULATE(min('Table'[Date]),ALLEXCEPT('Table','Table'[ID])),1,0)),[check]=1)
return countx(tbl,[ID])

1.PNG





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

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ryan_mayu
Super User
Super User

what's the logic of calculation?

why unique is 2 for location 1 and 1 for location 2?

what do you mean by visit again? how many ID visit the same location more than once?

 





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

Proud to be a Super User!




Sorry Unique should be First visit, wrong naming scheme. Clients will could visit the same venue more than once. I've figured out a very work around way to do this now. 

I've made a bunch of calculated columns for what I need then do a measure to only count the earliest create date from each id.

you only have 2 ID, how locaition 1 is 2 and locaion 2 is 1, totally 3?





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

Proud to be a Super User!




I made a mistake. I've fixed it. I'd be happy to hear if you have a solution?

@JayReidy 

maybe you can try this

Measure = 
var tbl= FILTER(ADDCOLUMNS('Table',"check",if('Table'[Date]=CALCULATE(min('Table'[Date]),ALLEXCEPT('Table','Table'[ID])),1,0)),[check]=1)
return countx(tbl,[ID])

1.PNG





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

Proud to be a Super User!




Yea this is the solution I came up with as well. Just with more steps. Thanks

you are welcome





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

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.