Forum Discussion
var return with Slicers.
- 6 years ago
Right but you are still using VAR's and CALCULATE weird. Try this:
Quantity sold = CALCULATE( SUMX( sales, sales[quantity]), DATESYTD( date[date] ), FILTER( product, product[code] = "A") )The other option would be to take your 2 VAR's and turn them into their own measures, then what you are doing with the CALCULATE would make more sense.
Yes. It is working.
Because I have many similar calculation, I tried to use var - return calculation.
I am not familiar with dax yet, I have tried.
Can you please advise me that any web page or helpful document that can help me to understand var - return calculation?
A VAR within a DAX calculation is a bit of a misnomer. Once you calculate a VAR, it is static (hence why it is a bit of misnomer). You cannot use CALCULATE to recalculate a VAR. You generally use CALCULATE to calculate a measure or DAX expression with some new filter criteria. A VAR is really useful when you want to break down a complex calculation into manageable chunks or avoid doing the same calculation twice (like in an IF statement). However, the way you were using them is simply invalid.
- Young_G_Han6 years agoHelper III
Thank you. It helps me a lot. I got one step close to DAX formula.
Have a good day.