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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
amyWMFS
Helper I
Helper I

Looking up rows related to a measure

Hello,

I have several measures, each using a different query, that calculate various KPIs, such as the proportion of requests that were dealt within a specified deadline (they're all %).

All those have a colour coded rating, for instance if fewer than 70% of applications are dealt with within the deadline, it's black, if it's between between 70% and 96% it's red, etc. The rating thresholds are different for each measure.

I'm using a 'switch' measure to apply the conditional formatting. Here's one of the CF measures:

CF Applications = switch(
true(),
[% Deadline met] < 0.7,"#000000",
and( [% Deadline met]>= 0.7, [% Deadline met]<0.96),"#D64550",
and([% Deadline met]>= 0.96, [% Deadline met]<0.99),"#E66C37",
[% Deadline met]>= 0.99,"#21BF75")

However, there is a good likelihood that those rating thresholds will be reviewed and changed in the future, so my next step is to try and find a way to bring those CF thresholds from another query rather than type them in the measure, a query coming from a dataset saved somehwere that can be easily accessed (for example from a spreadsheet).

And now I'm stuck. I can't use 'related' because these are measures. Any suggestions on what to do next?

Thank you

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @amyWMFS ,

 

The option you have for this is to create a table witht the settings you need something similar to this:

 

ID Min Max Condittional Formatting
1 0 0,7 #000000
2 0.7 0,96 #D64550
3 0,96 0,99 #E66C37
4 0,99 100 #21BF75

 

Now create the following measure:

 

 
Condittional formatting = 
VAR temp_table =
    FILTER (
        ALL ( Formatting ),
        Formatting[Min] <= [% completed]
            && Formatting[Max] >= [% completed]
    )
RETURN
    MINX ( temp_table, Formatting[Condittional Formatting] )
 
 

condi.png

 

Check PBIX file attach. You can make the table connected to an excel file.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @amyWMFS ,

 

The option you have for this is to create a table witht the settings you need something similar to this:

 

ID Min Max Condittional Formatting
1 0 0,7 #000000
2 0.7 0,96 #D64550
3 0,96 0,99 #E66C37
4 0,99 100 #21BF75

 

Now create the following measure:

 

 
Condittional formatting = 
VAR temp_table =
    FILTER (
        ALL ( Formatting ),
        Formatting[Min] <= [% completed]
            && Formatting[Max] >= [% completed]
    )
RETURN
    MINX ( temp_table, Formatting[Condittional Formatting] )
 
 

condi.png

 

Check PBIX file attach. You can make the table connected to an excel file.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks Miguel, it works perfectly.

I modified it so that I can have all the different min and max for the various indicators in one table: I have a column in the table that identifies which indicator each row is for, and I added another condition for this in the 'filter' part, and so far it seems to work.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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