Forum Discussion

dange187's avatar
dange187
Frequent Visitor
2 years ago
Solved

Calculation Group Condiftional Formatting not working

I have a model where I have 1 calculation group for time intelligence. I am using it in a matrix so users can select what time intelligence options they see via a slicer for the calculation group. I want to apply conditional formatting to the growth measures to highlight green for positive growth, red for negative growth. I've found several articles about using the measure:

CFMeasure = IF ( SELECTEDVALUE( 'calcgrouptable'[calcgroup]) IN {"PM∆"},
[measure],
BLANK()

)

then using this in the conditional formatting for the table.

What is happening is, instead of the calculated item being shown in the result, the actual (uncalculated) value is shown so the conditional formatting isn't in the right context. When I add the conditional formatting measure to the table you can see the result is not as expected:

I suspect this may have something to do with precedence but I dont have any other calculation groups and I tried different precedence values to see if it would help, but nothing. 

  • I think I've figured out why this was not working but I dont fully understand the why.

    The calculation items I am trying to apply the formatting to are difference calculations so for example TY-PY. In the calculation I was using the format:

    SELECTEDMEASURE()-
    CALCULATE(
          SELECTEDMEASURE(),
                     'calcgroup'[calcitem] = "PM"

    )

    I noticed that when I changed to the process in the video shared by parry2k (thanks) that the measures which didnt reference other calculation items were working correctly. So I changed the second part of the above formula to just do the calculation for PM and not reference the other calculation item and...
    IT WORKS!

    Like I said, I dont really understand why it works this way and not the other, but whatever works. Now to change all my calculations items!

2 Replies

  • dange187's avatar
    dange187
    Frequent Visitor

    I think I've figured out why this was not working but I dont fully understand the why.

    The calculation items I am trying to apply the formatting to are difference calculations so for example TY-PY. In the calculation I was using the format:

    SELECTEDMEASURE()-
    CALCULATE(
          SELECTEDMEASURE(),
                     'calcgroup'[calcitem] = "PM"

    )

    I noticed that when I changed to the process in the video shared by parry2k (thanks) that the measures which didnt reference other calculation items were working correctly. So I changed the second part of the above formula to just do the calculation for PM and not reference the other calculation item and...
    IT WORKS!

    Like I said, I dont really understand why it works this way and not the other, but whatever works. Now to change all my calculations items!