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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

Filter values to compute aggregated measure

The previous post [here] didn't get answers, so I found out how to break it down to tackle the first steps first. 

I need to aggregate a measure by category, in the sense that the Quick Measures work. 

 

 

Target Share = MAXX( 
  KEEPFILTERS(VALUES(Cities[city_key])), 
  CALCULATE([Market Share]) )

 

 

 

And I have defined [Market Share] to be calculated for each city, among other geographic hierarchichal levels. 

 

While this does get a city-wise calculation, when I'm showing it in a Table, I'm not getting the maximum amongst the different cities... In fact I get the same measure than the regular [Market Share] as shown below... 

Diego-CDMX_0-1597433087769.png

How can I get this measure to show the maximum? 

 

In addition, I'd like to divide the maximum per group (also shown in the picture).  
I thought I was getting there by changing the filter conditions as follows: 

 

 

Target Share = MAXX(
  CALCULATETABLE( VALUES(Cities[city_key]), 
    ALLEXCEPT(Cities, Cities[group])), 
  [Market Share]
)

 

 

But then again, I can't get the maximum from all tables before hand, so I'd need to figure that out first.  

 

Thank you for your help.  

 

 

 

 

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

Your estado and grupo columns are also filtering the data.  In any case, your VALUES() is only making a table of just that city (I don't think you need the KEEPFILTERS()).  So you are getting the same result as [Market Share].  Please try this expression instead.  You can adapt it by adding/removing columns from the ALLSELECTED to get your other measures.

 

Target Share = MAXX(ALLSELECTED(Cities[ciudad], Cities[estado], Cities[grupo]), [Market Share])

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

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
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors