Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Making DATESBETWEEN dynamic

I am trying to get a table based on DATESBETWEEN, when I am using TODAY() I get the desired output, but when I try to use the values captured from a slicer as parameters in DATESBETWEEN I am not gett...
  • AntonioM's avatar
    4 years ago

    Are you creating a calculated data table here? These are only changed when you refresh, so won't update dynamically as you interact with the report. This means where you've used SELECTEDVALUE there is no selectedvalue because the table doesn't 'see' any slicers.

     

    Could you use time intelligence in your measures instead? Something like

    'measure' last month =
    VAR d = EOMONTH (SELECTEDVALUE(datetime[Value]), 0)
    CALCULATE ( [Measure], DATESBETWEEN ( 'Calendar'[Date], d - 30, d )

     

    You could maybe try filtering the date tabe using a measure, something that gets the selected timeframe and flags the dates which are within that timeframe from the slicer date.