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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Conditional formatting measure which apply font color based on selected measure

Hi everyone,

 

I am trying to apply the same font color conditional format for many columns using a measure instead of configure it using a rule manually to each column.

The idea is that if I want to change the rule in the future I can do it changing the DAX formula of the conditional format measure instead of change it in each column one by one.

 

Here is the example:

I have 1 table in my datasource:

TABLE 1: date, product, sales, forecast, quota

I created 4 measures:

MEASURE salesOverQuota = DIVIDE(SUM(sales)-SUM(quota), SUM(quota), 0)

MEASURE forecasOverQuota = DIVIDE(SUM(forecast)-SUM(quota), SUM(quota), 0)

MEASURE salesOverForecast = DIVIDE(SUM(sales)-SUM(forecast), SUM(forecast), 0)

MEASURE salesYoYGrowth(%) =

    DIVIDE(

        SUM(sales)

        - CALCULATE(

                SUM(sales)

                ,SAMEPERIODLASTYEAR('Reference Date'[Date])
          ),
        , 

        CALCULATE(

                SUM(sales)

                ,SAMEPERIODLASTYEAR('Reference Date'[Date])
          )
        , 0
        )

 

In the report I included a matrix using product as rows and the measures as values.

To apply the same font color conditional format I created a new measure:

MEASURE overFontColor = IF(SELECTEDMEASURE() > 0, "#0D8224", "#FF0D00") --(green if true, red if false)

 

I select "overFontColor" as field value which should be based on the font color but it does not work (all values are red or green and the rule is not applied by cell values).

Any idea to solve the problem?

Thanks in advance.

 

 

 

 

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , I checked this selectedmeasure couple of days back and this did work atleast with calculation group and it did not work

 

Using code given in my blog- I was able to get selected measure in case of field parameters, and check if that can help

 

check for selectedmeasure code

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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