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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AaronGlenn10
Helper III
Helper III

Matrix Help - Top Sales within each City

PBI Rock Stars:  I have a matrix which displays the top 30 cities by sales volumes [see below] -- each city is comprised of a list of restaurants that report TABC sales.  Would like to create a measure that returns the top performing restaurantt for each city based on 'TABC Sales'.  Is this possible?

 

AaronGlenn10_0-1639396881463.png

 

Thank you so much!  ~AGS

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @AaronGlenn10 

Measure code:

Measure = 
    var _maxSales =MAXX(ALLEXCEPT('Table','Table'[Region]),CALCULATE(SUM('Table'[TABC Sales]),ALLEXCEPT('Table','Table'[Region],'Table'[Restaurant])))
    var _restaurant= CALCULATE(SELECTEDVALUE('Table'[Restaurant]),FILTER(ALLEXCEPT('Table','Table'[Region]),CALCULATE(SUM('Table'[TABC Sales]),ALLEXCEPT('Table','Table'[Region],'Table'[Restaurant]))=_maxSales))
return IF(ISINSCOPE('Table'[Restaurant])||NOT(HASONEFILTER('Table'[Region])),BLANK(),_restaurant)

vxiaotang_1-1640339199014.pngvxiaotang_0-1640339183946.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @AaronGlenn10 

Measure code:

Measure = 
    var _maxSales =MAXX(ALLEXCEPT('Table','Table'[Region]),CALCULATE(SUM('Table'[TABC Sales]),ALLEXCEPT('Table','Table'[Region],'Table'[Restaurant])))
    var _restaurant= CALCULATE(SELECTEDVALUE('Table'[Restaurant]),FILTER(ALLEXCEPT('Table','Table'[Region]),CALCULATE(SUM('Table'[TABC Sales]),ALLEXCEPT('Table','Table'[Region],'Table'[Restaurant]))=_maxSales))
return IF(ISINSCOPE('Table'[Restaurant])||NOT(HASONEFILTER('Table'[Region])),BLANK(),_restaurant)

vxiaotang_1-1640339199014.pngvxiaotang_0-1640339183946.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

negi007
Community Champion
Community Champion

@AaronGlenn10 

you can prevent interaction between two visuals using edit interactions then blocking it

 

negi007_0-1639411365040.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

negi007
Community Champion
Community Champion

@AaronGlenn10  in this case you can create a column to filter out max value for each region like below

 

MaxValue =
if (CALCULATE ( MAX ( 'Table'[tabc sales] ), ALLEXCEPT ( 'Table', 'Table'[region] ) )='Table'[tabc sales]
, "top","others")
 
negi007_0-1639404443738.png

 

then in your visual keep the top from MaxValue filter applied so that only top values are visible in matrix

negi007_1-1639404511764.png

 

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Thank you -- the measure appears to be overriding the 'Top Filter' I have applied in the Matrix Visual.  Is there a way to prevent?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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