Forum Discussion

GoresiDevBI's avatar
GoresiDevBI
Regular Visitor
1 month ago
Solved

Conditional formatting using multiple calculation groups

I have a question. I have a matrix where I want to use two calculation groups: one for Time Intelligence and another that controls the selected measure. I also have a generic measure that I use in th...
  • Shai_Karmani's avatar
    1 month ago

    Drive the color from a dedicated measure that checks the current Time Intelligence calculation item and returns BLANK() for the ones you do not want to color. In a matrix the color measure is evaluated once per column, so returning BLANK() effectively turns formatting off for those columns while it still applies where you return a color.

    Variation Color =
    VAR CurrentItem = SELECTEDVALUE ( 'Time Intelligence'[Name] )
    VAR Val = [generic_measure]
    RETURN
        SWITCH (
            TRUE(),
            CurrentItem IN { "Variation1", "Variation2" } && Val > 0, "#2E7D32",
            CurrentItem IN { "Variation1", "Variation2" } && Val < 0, "#C62828",
            BLANK()
        )

    Then on generic_measure open Conditional formatting, choose Background color or Font color, pick Format by: Field value and select Variation Color. Adjust the column name inside SELECTEDVALUE to match the actual column of your Time Intelligence calculation group. The second calculation group keeps working because the color measure references [generic_measure], which resolves under whatever that group dictates.

     

    If it solved your issue, please mark it as the accepted solution and give it a kudos.

     

    Best regards,
    Shai Karmani

     

    Let's connect in LinkedIn