Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 needs to be:
QuoteTest =
VAR selectedMin =
FIRSTDATE ( ALLSELECTED ( CRMDetails[ActivityDate] ) )
VAR selectedMax =
LASTDATE ( ALLSELECTED ( CRMDetails[ActivityDate3] ) )
RETURN
CALCULATE (
DISTINCTCOUNT ( CRMDetails[AgentID] ),
FILTER (
ALL ( QMFact ),
[DateQuoted] >= selectedMin
&& [DateQuoted] <= selectedMax
)
)
Without creating a calculated column, is there a way to do this in DAX?
Hello @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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 19 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 20 | |
| 12 | |
| 10 |