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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
A_Scott
Helper I
Helper I

Dax to return the top store based on # of product

I currently have this statement:

Top IFD Store Current IFD =
var
rankcontext = values('All Open Retail Locations'[Division-Store])
return
calculate( [Current IFD],
topn(1, all('All Open Retail Locations'[Division-Store]), [Current IFD] ),
rankcontext )

 

It is returning the [Current IFD]. I need it to return the [Division-Store]. I am trying to create a table that shows the top store for each district. My table will look like this, excepet it will only display one store per district not all the stores in all districts.

A_Scott_0-1684326383126.png

 

1 REPLY 1
amitchandak
Super User
Super User

@A_Scott , try like

maxx(topn(1, all('All Open Retail Locations'[Division-Store]), [Current IFD] ),'All Open Retail Locations'[Division-Store])

 

Also, consider index function

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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