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
Anonymous
Not applicable

How to derive measure from specific given hierarchy?

I have a geography hierarchy, say 

 

City > Borough > Neighborhood

 

I have created a measure that works on any of the levels, say

 

Market Share = DIVIDE([Subscriptors], [Universe], BLANK())

 

 and where both `[Subscriptors]` and `[Universe]` sum their parts based on the hierarchy relation. 

 

Then I have classified the cities with a new grouping column, say `Cities[cluster]` .  

And so I want to calculate something similar to: 

 

Target Share = CALCULATE( MAX([Market Share]), 
   FILTER(Cities, [cluster] = MAX([cluster])))

 

That is to say, the maximum market share, amongst the cities with the same grouping.  

 

I'm still missing two pieces of the puzzle: 
i)  Letting Power BI know that I want to consider the market shares at the city level. 

ii) Only considering those cities that belong to that same cluster.  

 

One approach that fixed item (i) is the one followin the Quick Measure formats as follows: 

 

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

 

However, I couldn't figure out where to include condition that the `Cities[cluster]` be the same.  

 

I hope this makes sense, and thanks for checking it out.  

Cheers from Mexico.  

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for your answer. 

While the suggested formula didn't work, and I tried different combinations of the above to get to the following: 

Target Share = MAXX( 
    ALLEXCEPT(Cities, Cities[cluster]), 
    [Market Share])

Diego-CDMX_0-1597680103907.png

 

Thanks! 

 

View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Since [Target Share] is a measure, you don't need to wrap it in CALCULATE in your [Target Share] MAXX measure.  You also shouldn't need the KEEPFILTERS around the VALUES.  In any case, here is a way to get the MAXX of the cities within a common Cluster.

 

MAXX Cluster = CALCULATE(MAXX(ALL(Cities[City]), [Market Share]), VALUES(Cities[Cluster]))

 

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


Anonymous
Not applicable

Thank you for your answer. 

While the suggested formula didn't work, and I tried different combinations of the above to get to the following: 

Target Share = MAXX( 
    ALLEXCEPT(Cities, Cities[cluster]), 
    [Market Share])

Diego-CDMX_0-1597680103907.png

 

Thanks! 

 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.