Forum Discussion
Making DATESBETWEEN dynamic
- 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.
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.