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
JituPBI
Frequent Visitor

Conditional formating using what if parameter

Hello Community Members

I have a question related to what dynamic conditional formating using What if parameter

When I am trying to conditionally format a bar graph data color using a measure with hard coded values the conditional formating works fine but when I try to replace the hard coded numbers with selected values in what if parameter slicer my conditional formating is not working as expected and behaving wierldly. Can anyone help in this regard

 

Test_color =

IF (

    [% Approved BIAs] >= 0.9,

    "#45ac34",

    IF (

        [% Approved BIAs] >= 0.8,

        "#ee7203",

        IF ( [% Approved BIAs] <= 0.7, "#e51f22" )

    )

)

This measure works fine

 

but the moment is replace the 0.9, 0.8 and 0.7 with the values below

 

Test_color =
IF (
    [% Approved BIAs] >= [% Approved Bia's - Green Config Table Value],
    "#45ac34",
    IF (
        [% Approved BIAs] >= [% Approved Bia's - Amber Config Table Value],
        "#ee7203",
        IF ( [% Approved BIAs] <=[% Approved Bia's - Red Config Table Value], "#e51f22" )
    )
 
In the above logic I am giving the user configure the thresholds using the slicers like below the results are not showing the same way it should be. Any help would be appreciated.
 
JituPBI_0-1676440768806.png
2 ACCEPTED SOLUTIONS

@AllisonKennedy , Can you please share the pbix file with me to check my side

View solution in original post

@JituPBI  Sample file attached below signature.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

5 REPLIES 5
AllisonKennedy
Super User
Super User

@JituPBI 
Make sure the DAX for your [% Approved Bia's - Amber Config Table Value] is correct. If you're using the default - ensure you have a default value supplied. Also check that your value is a number and not percent - you may need to multiply or divide by 100 to get it to behave as expected.

 

Finally (or maybe initially) - are you trying to conditionally format the same slicer as the what if parameter? This doesn't work unfortunately since the context of the slicer itself still has all the values for that parameter. You need to apply the conditional formatting on a different visual than the slicer. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hello @AllisonKennedy, I am using the correct DAX for [% Approved Bia's - Amber Config Table Value] and it is also configured correctly as decimal number where as the value that I want to change as per the result on the slicer is on a bar graph and not trying to format the slicer. Maybe If possible I can connect with you and explain my scenario, If that helps

@JituPBI  It works in my test: 

 

AllisonKennedy_1-1676451872388.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy , Can you please share the pbix file with me to check my side

@JituPBI  Sample file attached below signature.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.