Forum Discussion

H_insight's avatar
H_insight
Helper V
4 years ago
Solved

Last N Days

Hi All,   I am creating a measure to return the count of all (non-blank) values based on a slicer. The slicer is a series 0,90. For some reason, I am not getting any results, so I wonder if anyone ...
  • AllisonKennedy's avatar
    4 years ago

    H_insight 

    A couple of things: 

     

    1) your data doesn't have any records in the last 90 days. Most recent is May 2020.

     

    2) You're filtering for date < date which will make your measure always blank.

     

    If we change TODAY() in your measure to May 2020 and remove that filter, you'll get results:

     

    Last N days =
    VAR _Lastdate = DATE(2020, 05,30)
    Return
    CALCULATE (
    COUNT(Employee[SaleValue]),
    FILTER (
    ALL ('Calendar' ),
    Calendar[Date] > _Lastdate - SELECTEDVALUE('Last N Days'[Last N Days])
     
    )
    )