Forum Discussion
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 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])
8 Replies
- Greg_Deckler
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]) - lanluokaka
Microsoft Employee
Thank you so much! It works, why does it need the max id in the first var?
- Greg_Deckler
Community Champion
lanluokaka Just a way of not having to use EARLIER
- lanluokaka
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
Microsoft Employee
Greg_Deckler single row was expected. Now it has multiple repeated rows. Do you have suggestions?
This is the screenshot before the measure.
- Greg_Deckler
Community Champion
lanluokaka Are you missing a relationship?