Forum Discussion
How does variable works with the Calculate Function?
- 2 years ago
Hi Jack007 ,
Your second measure does not return the expected result because the revenue_calc value is calculated once, and never more. It is calculated when your variable is declared, when the calendar filter context is active. Your variable therefore stores revenues for the selected year. Then, in the "calculate()" part, this value is called directly and not recalculated, so the ALL() function doesn't change anything.
I am not sure my explanations are understandable ๐ but you can find the idea in this article.
If I answered your question, please mark my post as a solution.
Best,
Hi Jack007 ,
Your second measure does not return the expected result because the revenue_calc value is calculated once, and never more. It is calculated when your variable is declared, when the calendar filter context is active. Your variable therefore stores revenues for the selected year. Then, in the "calculate()" part, this value is called directly and not recalculated, so the ALL() function doesn't change anything.
I am not sure my explanations are understandable ๐ but you can find the idea in this article.
If I answered your question, please mark my post as a solution.
Best,