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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
Use case: Count the number of cars available per month based on a start and end dates.
Model: The model is simple one calendar and another fact table without relationship.
Dax Formulas: I have achive this with 2 formulas, one is correct but with bad performance another total is not correct for totals but the performance is good:
Pbix File: File with Example
Could you support me to achive the correct value with good performance.
Solved! Go to Solution.
You can try this formula:
_Cars_PerMonthAndDay =
Var __Result = SUMX(
'Calendar',
Var __Date = 'Calendar'[Date]
return COUNTROWS(
FILTER(
Cars,
Cars[ValidFrom] <= __Date &&
Cars[ValidUntil] >= __Date
)
)
)
RETURN __Result
In my observation, the results are accurate and it is performing better than your version.
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
|
_Cars_PerMonthAndDay =
SUMX(
Cars,
VAR __from = Cars[ValidFrom]
VAR __until = Cars[ValidUntil]
RETURN
CALCULATE(
COUNTROWS( 'Calendar' ),
'Calendar'[Date] >= __from,
'Calendar'[Date] <= __until
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
_Cars_PerMonthAndDay =
SUMX(
Cars,
VAR __from = Cars[ValidFrom]
VAR __until = Cars[ValidUntil]
RETURN
CALCULATE(
COUNTROWS( 'Calendar' ),
'Calendar'[Date] >= __from,
'Calendar'[Date] <= __until
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
You can try this formula:
_Cars_PerMonthAndDay =
Var __Result = SUMX(
'Calendar',
Var __Date = 'Calendar'[Date]
return COUNTROWS(
FILTER(
Cars,
Cars[ValidFrom] <= __Date &&
Cars[ValidUntil] >= __Date
)
)
)
RETURN __Result
In my observation, the results are accurate and it is performing better than your version.
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
|
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 |
|---|---|
| 9 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |
| User | Count |
|---|---|
| 23 | |
| 20 | |
| 18 | |
| 14 | |
| 14 |