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
Good sunday everyone
Does anyone know why when I use filter(all()) calculations, if it is in a variable measure it does not work but as a separate measure it will work.
For e.g.,
VAR totalsalesofshoes = calculate(sum(totalsales), type = shoes
return calculate(totalsalesofshoes,(filter(all(calendar),index>
Solved! Go to Solution.
@Anonymous Take a look at this article discussing the topic.
https://radacad.com/caution-when-using-variables-in-dax-and-power-bi
Basically, the CALCULATE will not do anything to the VAR totalsalesofshoes the way your measure is written.
Ohh thanks for the article. Then what do u suggest I do? Create a separate measure or is there another solution?
Yes, make it into two measures.
totalsalesofshoes =
CALCULATE ( SUM ( totalsales[Sales] ), type = shoes )Final Measure =
CALCULATE (
[totalsalesofshoes],
FILTER (
ALL ( calendar ),
index
>= MAX ( dim_Calendar[Index] ) - 5
&& dim_Calendar[Index] <= MAX ( dim_Calendar[Index] )
)
)
@Anonymous
You cannot use a variable like "totalsalesofshoes" as n expression inside CALCULATE. The variable will not be affected by filters therein.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous Take a look at this article discussing the topic.
https://radacad.com/caution-when-using-variables-in-dax-and-power-bi
Basically, the CALCULATE will not do anything to the VAR totalsalesofshoes the way your measure is written.
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 |
|---|---|
| 104 | |
| 81 | |
| 66 | |
| 50 | |
| 45 |