Conditonal Formatting - Field View problem

HI Everyone,

I have created a measure that will colour bars in a visualisation subject to meeting various conditons. The measure is called Table Colour. The problem I have is that when I access conditional formatting via Data Colors - Default Color - fx - Field Value, I cannot input the measure. It just won’t let me do anything. It will let me put in a data field but not a measure.

I am able to colour bars in the visualisation bu using Rules and I have done this in the model but I now wish to use more complex conditions for which I need a measure.

The screen shot below shows what I am doing and I also have attached my file.

I have seen videos that clearly show mesaures being used in the Field View so I am assuming i am missing something.

Fitbit.pbix (146.1 KB)
Can someone please tell me what I missing or doing incorrectly?

Thank You

Michael Gordon

Hi @MIchaelGordon,

There is an issue with the [Table Color] measure, you’re using AVERAGEX on text strings which results in an error.

Table Colour = 
AVERAGEX( data,
    SWITCH( TRUE(),
    Data[Target] = 2, "#12239E",
    Data[Target] = 1, "#00FF0C",
    "#70BBFF"
)) 

So made the following change to the measure:

Table Colour 2 = 
VAR myValue =
    AVERAGEX( data,
        Data[Target]
    )
RETURN

SWITCH(TRUE(),
    myValue = 2, "#12239E",
    myValue = 1, "#00FF0C", 
    "#70BBFF"
)

Now there is no issue, when calling it in the conditional formatting of Field values.

I hope this is helpful.

2 Likes

Melissa, Perfect, thank you very much.

Cheers Michael Gordon