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
Anonymous
Not applicable

Find Max Value from related

I have 2 tables. They have a many to one join on companyname

 

Table 1 = Data (Companyname, location, State)

Table 2 = Users (lastlogin, totallogins)

 

How can I return the number Users.TotalLogins?

 

I want to presume that Table2 might have more than one totallogins for whatever reason and return the bigger number.

 

Thanks

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

I think this works but is this the best method?

 

Largest Login = CALCULATE ( MAX ( 'Table2'[totalogins] ) )
 
However when I add the visual to a new card the title says Average of Largest Login

View solution in original post

The formula you've written works in a calculated column to get the max logins.  When you use it in a visual it is automatically aggregating that column (in this case an average).  You can use the pull down to change the type of aggregation (e.g., sum), but you may want to consider just using a measure instead of a calculated column.  In that case, you might just need a measure like

 

Max Logins = Max(Table2[TotalLogins])

 

If you use that in a visual with UserID, it will automatically give you the max for that user.

 

If this works for you, please mark it as the solution.  Kudos are great too.  Please let me know if it doesn't or if any questions.
Regards,
Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Greg_Deckler
Super User
Super User

Maybe: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Maybe: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I think this works but is this the best method?

 

Largest Login = CALCULATE ( MAX ( 'Table2'[totalogins] ) )
 
However when I add the visual to a new card the title says Average of Largest Login

The formula you've written works in a calculated column to get the max logins.  When you use it in a visual it is automatically aggregating that column (in this case an average).  You can use the pull down to change the type of aggregation (e.g., sum), but you may want to consider just using a measure instead of a calculated column.  In that case, you might just need a measure like

 

Max Logins = Max(Table2[TotalLogins])

 

If you use that in a visual with UserID, it will automatically give you the max for that user.

 

If this works for you, please mark it as the solution.  Kudos are great too.  Please let me know if it doesn't or if any questions.
Regards,
Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.

Top Solution Authors