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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Leo11
New Member

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.
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

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


View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

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


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.