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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AaronGlenn10
Helper III
Helper III

Return Max Result by Sales

Power BI Rock Stars:

 

I have a summary page for restaurant sales where users can select a CITY to review the total of all restaurants within that CITY. Trying to find a measure that will return the name of the restaurant within the SELECTED CITY that reported the highest sales for the current month.  Thank you! ~A

 

AaronGlenn10_0-1645228125026.png

 

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This measure should work

=FIRSTNONBLANK(TOPN(1,VALUES(Restaurants[Name]),[Total Sales]),1)

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This measure should work

=FIRSTNONBLANK(TOPN(1,VALUES(Restaurants[Name]),[Total Sales]),1)

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Ashish:

 

That worked - thank you!  How would I also return the sales amount ($) associated with that restaurant?

 

~A

You are welcome.  Please mark that reply as Answer.  Try this measure

=MAXX (Restaurants,[Total Sales])

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@AaronGlenn10 , Try TOPN

 

Top 1= calculate(max(Table[restutant]),TOPN(1,allselected(table[restutant]),[Total Measure],DESC), values(table[restutant]))

 

 

TOPN https://youtu.be/QIVEFp-QiOk

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.