Forum Discussion

PowerBITestingG's avatar
PowerBITestingG
Resolver I
2 years ago
Solved

Calculation Item Totals formatting

I have a matrix with Sales per Month and then MTD, YTD as calculation items.
In order to show MTD, YTD without having one per month, I am using IF(NOT(ISINSCOPE(Months),MTD)) and then I drill on "Columns"


The challenge I am facing is in how to apply a different conditional formatting to MTD and YTD. Because any format that I apply to Totals get applied to both. I even tried using somethign like:

IF(SELECTEDVALUE(CalcGroup[Periods])in {"MTD"},[TotalQuantity],BLANK())
 
But it still gets applied to both. Any ideas?
  • So you can create a new conditional measure that checks each calculation item that you want to format or/and excludes the others

    ConditionalFormat =
     var thisitem=
     SELECTEDVALUE('CalcGroup'[Name])

     return
     SWITCH(TRUE(),
      thisitem IN {"YTD"},[YTD],
       thisitem IN {"Months"},[TotalQuantity],
       BLANK())
     
    then you can use the formula below for your calculation items, so that it uses the conditional formatting measure 

    IF (
    SELECTEDMEASURENAME () = "ConditionalFormat",
    SELECTEDMEASURE (),
    IF (
    NOT ( ISINSCOPE ( [Months] ) ),
    [YTD]
    )
    )

    Conditional Formatting of Calculation Group Columns in Power BI
    https://www.youtube.com/watch?v=TpD57zS2sQU

1 Reply

  • So you can create a new conditional measure that checks each calculation item that you want to format or/and excludes the others

    ConditionalFormat =
     var thisitem=
     SELECTEDVALUE('CalcGroup'[Name])

     return
     SWITCH(TRUE(),
      thisitem IN {"YTD"},[YTD],
       thisitem IN {"Months"},[TotalQuantity],
       BLANK())
     
    then you can use the formula below for your calculation items, so that it uses the conditional formatting measure 

    IF (
    SELECTEDMEASURENAME () = "ConditionalFormat",
    SELECTEDMEASURE (),
    IF (
    NOT ( ISINSCOPE ( [Months] ) ),
    [YTD]
    )
    )

    Conditional Formatting of Calculation Group Columns in Power BI
    https://www.youtube.com/watch?v=TpD57zS2sQU