Forum Discussion
Anonymous
5 years agoNot applicable
Problem with DATESINPERIOD function
Hello, I have a table of self reports of COVID symptoms which contatins user ID (AccountName) and the date of the report. I'm trying to create a function which sums the unique reports over th...
- 5 years ago
Hey Anonymous ,
you can use this DAX statement instead:
Reports_Lst2Wks_ALT = var _today = TODAY() var _7DaysBeforeToday = _today -7 return CALCULATE( DISTINCTCOUNT(selfreports[AccountName]) ,DATESBETWEEN(selfreports[Date] , _7DaysBeforeToday , _today) )DATESINPERIOD requires a dedicated date table without gaps, for this I recommend following the link Greg_Deckler provided in his post.
Hopefully, this helps to tackle your challenge.
Regards,
Tom
AntrikshSharma
5 years agoCommunity Champion
Anonymous Are you not slicing data by dates table?
=
VAR MaxVisibleDate =
MAX ( Dates[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( selfreports[AccountName] ),
DATESINPERIOD ( Dates[Date], MaxVisibleDate, -7, DAY )
)