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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Grouping of scores per region

Hi,

 

I am working on an a requirement to build a KPI  condition where for the KPI to be met it needs to fullfill 2 conditions.

Both conditions below should be met for the KPI to be considered as met else its not met. 

1. No country should be less than 90%.

2. No Region should be less than 95%.

 

Which essentially means that even though the region meets its target however if any country misses its target than the KPI is not met.
I would like to know how do i build this logic/calculation where

1. I can group the scores by country and region.

2.  Build the KPI condition mentioned above.

Here is a sample data 
NOTE: The way region is repeating in this data in the real data country also repeats.

 

RegionCountryScore
North AmericaUnited States100%
North AmericaCanada90%
Latin AmericaMexico100%
Latin AmericaTrinidad and Tobago98%
Latin AmericaBolivia85%

 

Shariq

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , see if this can help

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-power-query/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
mahoneypat
Microsoft Employee
Microsoft Employee

Assuming that the Region score is the average of the Country scores (you can change it if not), here is an expression that should work for your KPI.

 

Met Goals =
VAR __regionmin =
    MINX ( VALUES ( Scores[Region] ), CALCULATE ( AVERAGE ( Scores[Score] ) ) )
VAR __countrymin =
    MINX ( VALUES ( Scores[Country] ), CALCULATE ( AVERAGE ( Scores[Score] ) ) )
RETURN
    IF ( AND ( __regionmin >= 0.95, __countrymin >= 0.9 ), "Yes - 😊", "No - 😢" )

 

You said this was a KPI, so I used emoticons in the output (using Windows Key + "."), so please change to what you want to show.  Here is what the output might look like on a report page with slicers for Region and Country.

KPI.png

 

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

@mahoneypat the average for region needs to be the average of only the countries in that region. So i am thinking the filter you are applying via slicer needs to be applied within the calculation.

@Anonymous , the CALCULATE() in the region part ensures that only the countries in that region are included in the calculation for that region.  Please let me know the scenario in which you see an incorrect result.  Since it does MINX over regions and countries, it should work whether Region or Country is selected or not.  Only question is if a single Country is selected, how do you want that Region calculated (just use the selected country and calculate region result (current case), or remove country filter and include all countries for that region).

 

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


parry2k
Super User
Super User

@Anonymous how the region scores will be calculated, is that going to be average of all the countries under the region?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k yes exactly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.