Forum Discussion
Conditional formatting based on measure for a KPI visual
Hi MEtchart ,
Choose "Field value" under Format style, select the measuer you want.
If you still have doubts, please provide some sample data and the desired results.
Or provide some screenshots to explain the problem. Take care 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.
I don't know if picture will help, because I see the same thing as you do. It's just that the desired measure to be used is not listed in this overview.
I believe that the problem is related to the creation of a new dashboard with a pre-existing Power BI data model. If the Measure is in the original data model, it works. But if I create the meassure in the new BI file, as an addition to the retrieved data model, then the meassure is not available for use for some reason. Needless to say I don't have control over the original BI Data Model to make the measure there. Otherwise I wouldn't have this problem.
- Anonymous3 years agoNot applicable
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.
- MEtchart3 years agoNew Member
Let me see if I can exemplify with pictures.
this is the measure I want to use:
NPL on+off % color =SWITCH(TRUE(),[NPL on+off %] < 0,04, "Green",[NPL on+off %] >= 0,04 && [NPL on+off %] < 0,05, "blue",[NPL on+off %] >= 0,05, "red","")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.