Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
LastYearStoreCount = VAR lastFromDate = SELECTEDVALUE(WUSA_VIEW[From_Date1], TODAY()) - 364 VAR lastToDate = SELECTEDVALUE(WUSA_VIEW[To_Date1], TODAY()) - 364 RETURN IF([DateDiff] > 365, 0,
IF( FILTER(ALL(WUSA_CAL_DIM), WUSA_CAL_DIM[End_Date] >= lastFromDate && WUSA_CAL_DIM[End_Date] <= lastToDate),DISTINCTCOUNT(WUSA_STORE_DIM[Store Code]) ))
There is something wrong in the final if statement. Your filter statement is covering the entire if so there is no actual comparison happening.
I think what you actually need is a calculate statement instead of the if statement:
CALCULATE( DISTINCTCOUNT(WUSA_STORE_DIM[Store Code]), ALL(WUSA_CAL_DIM), WUSA_CAL_DIM[End_Date] >= lastFromDate, WUSA_CAL_DIM[End_Date] <= lastToDate )
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 77 | |
| 37 | |
| 31 | |
| 29 | |
| 26 |