Forum Discussion
wnicholl
3 years agoResolver II
Rolling Dates
I have dax measue that works but I beleive the dates are static and would need to be manually updated for the next months. I need the dates to automatically change; From: DATE(2022,05,01), DATE(2023...
- 3 years ago
Sorry, I misread your starting date, it is in 2022 so that would look like this which makes more sense.
2023 Inforce = VAR _Start = EOMONTH ( TODAY(), -13 ) + 1 VAR _End = EOMONTH ( TODAY(), -1 ) RETURN CALCULATE ( COUNTA ( 'AISCVGP'[ACCUS#] ), AISCVGP[ACSTA] = "ACT", DATESBETWEEN ( 'Calendar'[Date], _Start, _End ) )
jdbuchanan71
3 years agoSuper User
You can use TODAY() to get a dynamic date range. Next month should it be
DATE(2022,06,01), DATE(2023,05,30) or
DATE(2022,06,01), DATE(2023,05,31) ?
Assuming you want the first of the month and the end of the previous month it would be like this.
2023 Inforce =
VAR _Start = EOMONTH ( TODAY (), -1 )
VAR _End = _Start + 1
RETURN
CALCULATE (
COUNTA ( 'AISCVGP'[ACCUS#] ),
AISCVGP[ACSTA] = "ACT",
DATESBETWEEN ( 'Calendar'[Date], _End, _Start )
)
You also don't need the FILTER('AISCVGP' portion and it is a bad idea to use FILTER over a whole table so I updated that as well.
wnicholl
3 years agoResolver II
I tried the measure and it's returning no values. Yes, the next set of dates should be DATE(2022,06,01), DATE(2023,05,31). Any other suggestions? If I use datesbetween I would need to update the dates manually...is that corrcet? Thank you!