Forum Discussion

Leo11's avatar
Leo11
New Member
2 years ago
Solved

Power BI won't recognize data for conditional formatting

I have a chart which the title will change colors depending on the value of the data.

For example:

Green for "0", yellow for "1" and red for "2".

To get this values I created a measure which will bring these values depending on the month (filter).

The formula: 

LOOKUPVALUE('PBI Finance DB'[Trucks Net Sales Actual Evaluation],'PBI Finance DB'[Mês],MONTH(SELECTEDVALUE('PBI Finance DB'[Date])))
So basically, it gets the month selected on the filter, for example: April. Transforms into a numeric month -> 4 - > look up for the value on a column with numeric months ('PBI Finance DB'[Mês]) and return the values which I need from the column 'PBI Finance DB'[Trucks Net Sales Actual Evaluation].
If i put this measure on a card, it displays the correct value. However, when I apply the conditional formatting, it won't work.
If I set the conditional formatting to "is blank", it will change it's color.
Another weird thing that happens is if I substitute the formula MONTH(SELECTEDVALUE('PBI Finance DB'[Date])) for a value, like "4", the conditional formatting will work as it should be.
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Leo,

    //Another weird thing that happens is if I substitute the formula MONTH(SELECTEDVALUE('PBI Finance DB'[Date])) for a value, like "4", the conditional formatting will work as it should be.

    Does the filter context for PBI Finance DB'[Date] contain multiple values? It will return the second parameter by default when it contains multiple values, which is now blank.
    Try the following code.
    MONTH(SELECTEDVALUE('PBI Finance DB'[Date],MAX('PBI Finance DB'[Date]))) ​

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group


1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Leo,

    //Another weird thing that happens is if I substitute the formula MONTH(SELECTEDVALUE('PBI Finance DB'[Date])) for a value, like "4", the conditional formatting will work as it should be.

    Does the filter context for PBI Finance DB'[Date] contain multiple values? It will return the second parameter by default when it contains multiple values, which is now blank.
    Try the following code.
    MONTH(SELECTEDVALUE('PBI Finance DB'[Date],MAX('PBI Finance DB'[Date]))) ​

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group