Forum Discussion

corange's avatar
corange
Post Patron
6 years ago
Solved

Conditional Formatting - Less / Greater than

Hi POWER BI Team,    I need some help with a project. I have looked around but could not find an answer and the conditonal formatting function in the format section doesn't do the trick for me.   ...
  • v-juanli-msft's avatar
    6 years ago

    Hi corange 

    I have a solution below though it is a little different from your final expected result.

    week is a column

    week = IF(TODAY()=[date],"today",FORMAT([date],"dddd"))

    [Measure] is a measure

    Measure =
    VAR sl =
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[client] = MAX ( 'Table'[client] )
                    && 'Table'[week] <> "today"
            )
        )
    VAR t =
        SUM ( 'Table'[value] )
    RETURN
        IF (
            MAX ( [week] ) = "today",
            SWITCH (
                TRUE (),
                t > sl
                    || (
                        t <> BLANK ()
                            && sl = BLANK ()
                    ), 1,
                t = sl
                    || (
                        t = BLANK ()
                            && sl = BLANK ()
                    ), 0,
                t < sl
                    || (
                        t = BLANK ()
                            && sl <> BLANK ()
                    ), -1
            )
        )
    

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.