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
alicia_mtz
Helper II
Helper II

Measures for conditional formatting are not available to select

Hi!

 

I want to colorized my column depending on the value of the row.

 

- If the value is below 90% in red, between 90 and 100% in black and over 100% in green.

 

I checked this topic and made a measure for it, modifying the one given as solution: How to apply conditional formatting 

 

My measure:

 

Conditional_color = 
VAR Percent_ = 
    [Total] / [Target]
RETURN
    SWITCH (
        TRUE (),
        Percent_ < .9, 1,
        Percent_ >= .9
            && Percent_ < 1, 2,
        Percent_ >= 1, 3)

 

 

But when I choose "Field value" to base it on my measure, this measure and all the other measures appear in grey and I cannot select them.

 

I saw this topic and there is an answer saying to change the data type into TEXT, but I don't have text among my options, only general or numerical options. There is no solution answer on that topic though: Conditional formatting measures not available 

 

Does anybody know why I'm unable to pick measures to colorised the matrix? Do I have an error on my code?

 

Thank you so much 😊

 

 

1 ACCEPTED SOLUTION

HI @alicia_mtz,

Here is the measure formula for color formatting, you can create a new measure with these codes and set 'background color' conditional formatting with 'field value' mode on the '% Sales vs Target' field:

color format =
IF (
    [% Sales vs Target] < 0.9,
    "Red",
    IF ( [% Sales vs Target] <= 1, "Blue", "Green" )
)

3.png

Notice: If these default color names are not suitable for your requirement, you can also use a 6-bit hex color code to replace the color names in the above formula.

5.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @alicia_mtz,

Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft 

 

I attach the pbix with some dummy data and the measure I'm trying to use. I also add here a screenshot to see if this helps too. Since I cannot attach it here directly I've uploaded it into my drive. Here is the link to download it:

 

https://drive.google.com/file/d/1NX-L8syJodQRh2fdrhAqqUIjdQ35qR8K/view?usp=sharing

 

alicia_mtz_0-1653583414929.png

 

You see here colourised the value over 100% in green. What I want is the values from 0 to 90% in red, between 90 and 100% in blue (or even better not colourise these ones) and over 100% in green. 

 

I only manage to colourise the green one and I know I didn't set it up very well either... (you can see it in the pbix)

 

Thank you so much for your help! 🙂 

 

 

HI @alicia_mtz,

Here is the measure formula for color formatting, you can create a new measure with these codes and set 'background color' conditional formatting with 'field value' mode on the '% Sales vs Target' field:

color format =
IF (
    [% Sales vs Target] < 0.9,
    "Red",
    IF ( [% Sales vs Target] <= 1, "Blue", "Green" )
)

3.png

Notice: If these default color names are not suitable for your requirement, you can also use a 6-bit hex color code to replace the color names in the above formula.

5.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft 

 

That's BRILLIANT! That's exactly what I needed, thank you so much! 

 

I guess I wasn't able to choose my measure because it has an error somewhere in the code... I'm still learning and I should try to keep it simple as much as possible...

 

I already tried different colours using your code and even hex code and all works.

 

Thank you very much!! 😊😊😊

 

 

alicia_mtz
Helper II
Helper II

Hi @AnamPatel

 

Thank you for your answer, unfortunately, that option doesn't work for me.

 

If you have the last rule as = 100, it doesn't give you the option to colourise also the results above 100, and if you write it as >= 100 (like the 90 value in the previous line) I need to give a maximum value on the right side (previous line as a <100 )  but I don't want to write a number there, because you never know how above target your value can be...

 

That's the reason I was writing the code, but I cannot select it 😞 

 

I appreciate you took the time to reply to me, thank you 😊

 

I hope someone know the reason I'm unable to choose the measure. 🤔

AnamPatel
Resolver II
Resolver II

There is an easier way to do Conditional Formatting. You can achieve this without a measure as well. Below are the steps –

Click on the Down Arrow in front of the Column Name under Values Tab and Select Conditional Formatting > Background Color

AnamPatel_0-1652956430704.png

 

A new Background Color window will pop up – fill all the details, select the colors you want and click on OK.

 

 

AnamPatel_1-1652956430708.png

 

That’s it, the colors will show up on your chart –

AnamPatel_2-1652956430711.png

 

Let me know this works for you.

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.