Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Bar chart including dates before the slicer date

Hello all!   I need to build a bar chart, which marks the last data date of a date slicer, but I want it to show not only the date of that filtered day, but also data up to 21 days prior to that sl...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    Please have a try.

    Create a calendar table and put the dates in the calendar table into the slicer.

    Table 2 = CALENDAR(DATE(2022,1,1),DATE(2022,5,31))

    Then create measures.

    measure_beforedate =
    VAR _sel =
        SELECTEDVALUE ( 'Table 2'[Date] )
    RETURN
        IF ( MAX ( 'Table'[date] ) <= _sel, 1, 0 )
    
    Measure_values =
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[date] <= SELECTEDVALUE ( 'Table 2'[Date] ) ),
        'Table'[value]
    )
    

     

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.