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
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
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.