Forum Discussion
Conditional formatting based on measure for a KPI visual
Hi MEtchart ,
I don't know if my understanding is wrong, are you saying that you don't have a measure in the slide bar above? If you don't create a measure in your data model, of course there won't be a measure, we created it ourselves.
For example
Measure = IF(SUM('Table'[Value])=100,"RED","GREEN")
About creating measures, refer to
Tutorial: Create your own measures in Power BI Desktop - Power BI | Microsoft Learn
There are a few considerations to keep in mind when working with conditional table formatting:
- Any table that doesn't have a grouping is displayed as a single row that doesn't support conditional formatting.
- You can't apply gradient formatting with automatic maximum/minimum values, or rule-based formatting with percentage rules, if your data contains NaN values. NaN means "Not a number," most commonly caused by a divide by zero error. You can use the DIVIDE() DAX function to avoid these errors.
- Conditional formatting needs an aggregation or measure to be applied to the value. That's why you see 'First' or 'Last' in the Color by value example. If you're building your report against an Analysis Service multidimensional cube, you won't be able to use an attribute for conditional formatting unless the cube owner has built a measure that provides the value.
If you still have doubts, it's better to provide some screenshots of the issue. Remember to protect your privacy.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Let me see if I can exemplify with pictures.
this is the measure I want to use:
and this is how the trend visual is made
And when I try to selec the 'Measure Table'[NPL on+off % color] measure as conditional formatting, click on it, the drop down list "What field should we base this on" remains blank:
As I mentioned, the 'Measure Table'[NPL on+off %] is in the original Data Model, and the 'Measure Table'[NPL on+off % color] is created new after uploading the pre-existing Data Model.