Forum Discussion

jps_HHH's avatar
jps_HHH
Helper II
1 year ago
Solved

include extra column - target

I've created a matrix table with the following charateritics:  - Rows:  are multiple measures that I created.   - Columns:  are months over the year   In order to put the measures as rows and t...
  • pankajnamekar25's avatar
    1 year ago

    Hello jps_HHH 

     

    try this solution

    Custom Column =

    UNION(

        SELECTCOLUMNS('DateTable', "Month", FORMAT('DateTable'[Date], "MMM YYYY")),

        DATATABLE("Month", STRING, {{"Target"}})

    )

     

     

     Update your value measure like this

    Final Value =

    VAR SelectedKPI = SELECTEDVALUE('Measures Table'[Key Performance Indicator])

    VAR CurrentCol = SELECTEDVALUE('Month_Column_Table'[Month])

     

    RETURN

    SWITCH(

        TRUE(),

        CurrentCol = "Target",

            SWITCH(

                SelectedKPI,

                "year Sales", [year Sales Target],

                "Training", [Training Target],

                "Quality", [Quality Target]

            ),

        -- Else return monthly values

        SWITCH(

            SelectedKPI,

            "year Sales", CALCULATE([year Sales], 'DateTable'[MonthYear] = CurrentCol),

            "Training", CALCULATE([Training], 'DateTable'[MonthYear] = CurrentCol),

            "Quality", CALCULATE([Quality - Issues/Batch], 'DateTable'[MonthYear] = CurrentCol)

        )

    )

     

     

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.