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
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
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.