Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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...
  • TomMartens's avatar
    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