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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
lanluokaka
Microsoft Employee
Microsoft Employee

Group max related value from another table

I have 2 tables, one just has ids, and the other one has those id usages. I want find the most used SDK within certain days. How do I make a measure to still keep the time slicer? And find the max usage-related SDK value in table 1.

lanluokaka_0-1632352596147.png

lanluokaka_1-1632352633793.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@lanluokaka Seems like Lookup Min/Max: Lookup Min/Max - Microsoft Power BI Community. In your case:

Measure = 
  VAR __ID = MAX('table 1'[id])
  VAR __MostUsage = MAXX(FILTER('table 2',[id]=__ID),[usage])
RETURN
  MAXX(FILTER('table 2',[id] = __ID && [usage]=__MostUsage),[sdk])
  


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

8 REPLIES 8
lanluokaka
Microsoft Employee
Microsoft Employee

Thanks, Greg! I just found it after I add some values from another table. It gives me all repeat measure results for one id. 

lanluokaka_0-1632424335456.png

 

@Greg_Deckler single row was expected. Now it has multiple repeated rows. Do you have suggestions?

This is the screenshot before the measure.

lanluokaka_0-1632432438421.png

 

@lanluokaka Are you missing a relationship?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I do have a relationship, it's based on the id.

@lanluokaka So, what do you want to happen? Which row should display?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
lanluokaka
Microsoft Employee
Microsoft Employee

Thank you so much! It works, why does it need the max id in the first var?

@lanluokaka Just a way of not having to use EARLIER



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@lanluokaka Seems like Lookup Min/Max: Lookup Min/Max - Microsoft Power BI Community. In your case:

Measure = 
  VAR __ID = MAX('table 1'[id])
  VAR __MostUsage = MAXX(FILTER('table 2',[id]=__ID),[usage])
RETURN
  MAXX(FILTER('table 2',[id] = __ID && [usage]=__MostUsage),[sdk])
  


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors
Top Kudoed Authors