Forum Discussion
Last N Days
- 4 years ago
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)ReturnCALCULATE (COUNT(Employee[SaleValue]),FILTER (ALL ('Calendar' ),Calendar[Date] > _Lastdate - SELECTEDVALUE('Last N Days'[Last N Days])))
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:
AllisonKennedy Thanks for your reply.
The updated measure has a hardcoded date of 30/05/2022 and the aim is to have a dynamic measure.
You have sparked my thinking (Thank you!), and I think I got the answer now. I have replaced _lastdate with Today() and most importantly I have added <= to the 2nd part of the filter.
VAR _Lastdate = TODAY()
Return
CALCULATE (
COUNT(Employee[SaleValue]),
FILTER (
ALL ('Calendar' ),
Calendar[Date] > _Lastdate - SELECTEDVALUE('Last N Days'[Last N Days])
&& Calendar[Date] <= _Lastdate
)
)
I will mark this as solution and thanks again for sharing your feedback.