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
Hi everyone,
I have a measure that really slows down by using the DATEADD function.
CALCULATE(DISTINCTCOUNT(Employee[EmployeeID]) , DATEADD('Date'[Date],-1,DAY))
Is there a better way to get the same output?
Luuk
Hi Luuk,
Been in your shoes! Almost exact problem, except that in my case it was DATEADD -1 YEAR over a DISTINCTCOUNT, for Month-over-month calculations. (same thing for -1 month)
What I found tracing with DAX was that adding DATEADD multiplied the number of SE queries performed. It did not have a huge impact if the model was hot (thanks to DAX caching), but it had a huge impact (3x time) in cold models / clear cache / fist load.
What I did was change the DATEADD, which I understand is done by the FE, into something I hoped closer to the SE. This is what improved quite a a lot the measure in my case:
/* --original query, relatively slow
VAR __clients_last_year = CALCULATE([clients],DATEADD(DateTable[Date],-1,YEAR))
RETURN
IF(ISBLANK([clients]),blank(),DIVIDE([clients]-__clients_last_year , __clients_last_year ))
*/
-- optimized -- note that this only works for single selections of date!
VAR __M_ANT = EDATE(selectedvalue(FactTable[date]) , -12) -- EDATE adds months
VAR __clients_last_year= CALCULATE([clients], ALL(DateTable), FactTable[date] = __M_ANT)
RETURN
DIVIDE([clients] - __clients_last_year, __clients_last_year)
This only works for single selections of date, but was about 3x more performant in my use case in cold calculations of the measure (which was used very often in my reports).
In your case, to add one day, it is much simpler than using EDATE.. just add +1 to move one day forward.
Hope this helps!
Hi Darek,
What could be the reason the measure slows down by the *- to -1 relations and the date marked table?
It is an import storage model and the measure DISTINCTCOUNT(Employee[EmployeeID]) performs without problems.
Luuk
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 31 | |
| 20 | |
| 13 | |
| 11 |