Forum Discussion
jcampbell474
Helper IV
6 years agoDAX Between two calculated dates
Good day, everyone. Hoping someone can help me w/some DAX. I need to count values if their date is -/+ 3-days from the activity date. Here's what I'm using, but it is not as accurate as it ...
vivran22
Community Champion
6 years agoHello jcampbell474
You may try this:
Count within 3 Days =
VAR _Duration = 3
VAR _StartDate = _SelectDate - _Duration
VAR _EndDate = _SelectDate + _Duration
VAR _Filter =
FILTER(
ALLSELECTED(dtTable[Order Date]),
dtTable[Order Date] >= _StartDate
&& dtTable[Order Date] <= _EndDate
)
VAR _Count =
CALCULATE(
[Distinct Orders],
_Filter
)
RETURN
_Count
Cheers!
Vivek
If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)
https://www.vivran.in/
Connect on LinkedIn