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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
garrettw
Frequent Visitor

OKViz Cards with States -- Can't figure out what field to use

Hello,

I've read the various blogs and tutorials and still can't get the visual to work the way that I expect. 

I have three numbers: an Actual, a Forecast, and a Target (based on number of working days this year so far).

I calculate the Actual / Forecast as a measure and put it into the "Measure" field.

I've tried:

1. Put the Target value  into "Target" Field, In this case the measure is 60.45% and the target is 57.14. This is over target, so it should be GREEN.

In states, I have chosen:
Affect: Background
Messages: Off
Value type: Percentage over target
Comparison: >=
Base Color: Red
State A: Green
State A Value: 0

If I"m understanding the example properly, at Target + 0%, the colour should change from Red to Green. It does not -- instead I'm getting a white background and red text.

If I change the State A Value to -.999, it does in fact change to Green so the indicator is changing. I don't understand why at State A Value of 0, I'm getting a White background instead of Red OR Green.

2. I also tried creating an Indicator measure -- basically the calculation of (Actual / Forecast) / Target. This should be <1 for under (Red), >=1 for acceptable (Green)

In this case I have a measure of 38.25% and a target of 57.14%. Indicator is .382/.571, so is <1. Should be red. I have the Measure Field in the Measure and the Target field in States Measure. Under States I have set Affect to Background, Messages off, Comparison >=, Base Color Red, State A Green, State A Value 1. This should be red. Instead I again have a white (no) background and red text. Again I change State A value to -1 and I get a green colour, so it is controlling the background, just not understanding where it's getting the white with red text setup from and why it's not changing to red or green as it should.

I feel like I must be missing something obvious, but unfortunately the blogs and samples I've seen (a) don't really deal with background colour instead of foreground, and (b) don't really show an example of what I'm trying to do -- they're all quite simple and seem to use table-based min/max rather than relative or indicator based calculations like I'm using.

Any help is appreciated. 

Thanks

Garrett






5 REPLIES 5
v-frfei-msft
Community Support
Community Support

Hi @garrettw ,

 

Did you try the conditional formatting function? If it doesn't meet your requirement, kindly share your sample data and excepted result to me. Please upload your files to One Drive and share the link here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Frank,

 

I think OP wants to use a card visual, and card visuals don't support conditional formatting.

 

Thanks,

Jon

Yes, in this case I can't use conditional formatting because I'm using cards for the presentation. The client's desired format requires percentage and dollar values in the same column so a matrix is not a possibility without some advanced coding.

I'm accomplishing the look they want using a grid of cards, and the handling of states is different than how conditional formatting works.

Just for the record, on the matrix sections that can use conditional formatting it works very well and is intuitive.

Have you tried returning text from a measure?

 

Create a measure like this, and set the data type to Text. Using this method, you can create dynamic output of text such as messages. You can even format by another field to use conditional formatting.

_dm_MeasureText = FORMAT([MyPercentage], "###%") & " " & FORMAT([MyDollars], "$###")

 

jsh121988
Employee
Employee

I'm new to this visual fyi, so this may only work for my scenario.

 

Under Value, put the text you want displayed.

Under States, put the measure with the value to be compared.

In the Format Tab, drop down States, and set your values in reverse order.

 

Example:

If i have a measure returning DaysOld, then I drop DaysOld onto States.

I then implement the following with the "Greater than or Equal to" operator selected.

DaysOld >= 8 then Red

DaysOld >= 4 then Orange

DaysOld >= 2 then Yellow

DaysOld >= 0 then Green

 

Default Green color.

 

I hope this helps a bit, but I know this was specific to my case.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.