Forum Discussion

ghutchins's avatar
ghutchins
Helper II
3 years ago
Solved

Date limit columns differently in one data visual

I have a visual that is showing the status of 4 columns.  It is easy to date limit the whole table by dropping the data into the filter for the visual or the page, but I need to date filter all the c...
  • ReneMoawad's avatar
    3 years ago

    Hi ghutchins,

     

    You need to create a new measure
    Value 
    Var selectedColumn = SELECTEDVALUE(Table[Column])

    Var startDate = SWITCH(selectedColumn

        , "Column A", DATE(2022, 6, 1)

        , "Column B", DATE(2022, 7, 1)

        , "Column C", DATE(2022, 8, 1)

        , "Column D", DATE(2022, 9, 1)

    )

    Var endDate = MAX(Table[DateColumn])
    RETURN

    CALCULATE(

        SUM('ColumnValue') COUNT('Columns)

        , ALL(Table[DateColumn])

        , Table[DateColumn] >= startDate

        . Table[DateColumn] <= endDate
    )