Forum Discussion
How filter argument in CALCULATE interact with outer filter context on different col in same table
Hi,
Either of these measures works. If you want to see the other months as well, you may wrap these functions in the COALESCE() function and specify the second argument as 0.
Sales _ = CALCULATE(SUM(Sales[Sales]), KEEPFILTERS('Date'[Date]=DATE(2023,5,1)))Sales _1 = CALCULATE(SUM(Sales[Sales]), FILTER(values('Date'[Date]),'Date'[Date]=DATE(2023,5,1)))
Hope this helps.
Thanks, but my questions is why the following measure shows the same value for all Year Month:
- Ashish_Mathur3 years agoSuper User
Hi,
If there is a conflict between the inner and outer filter (which is clearly your case), then the filter condition of the calculate function over writes the outer filter condition. To reverse this, you may either use the KEEPFILTER() or the FILTER() function.
- jj_05113 years agoHelper I
So the filter condition of the calculate function over writes the outer filter condition even when they are on different columns? Is this behavior documented anywhere?
- Ashish_Mathur3 years agoSuper User
Yes, that is what it looks like. Not sure of where this is documented.