Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello:
I have two tables:
Date:
sample data:
Date | Month Year |
2023-01-01 | Jan 2023 |
2023-01-02 | Jan 2023 |
... | ... |
Sales:
Date | Sales |
2023-01-01 | 9 |
2023-02-01 | 3 |
2023-03-01 | 3 |
2023-04-01 | 4 |
2023-05-01 | 2 |
I have a measure:
Why [Sales_] has same value for all [Month Year] in the table?
Please find pbix here: pbix sample
Thanks.
just your measure removes all filters
read about it here:
https://www.sqlbi.com/articles/introducing-calculate-in-dax/
https://youtu.be/HxZLkmpY6BA?t=270
your measure :
CALCULATE(
SUM(Sales[Sales])
, 'Date'[Date] = DATE(2023,5,1)
------
its complete syntax
CALCULATE(
SUM(Sales[Sales])
, FILTER(ALL('Date'), 'Date'[Date] = DATE(2023,5,1))
The complete syntax should be:
CALCULATE(
SUM(Sales[Sales])
, FILTER(ALL('Date'[Date]), 'Date'[Date] = DATE(2023,5,1))
Still calculate filter and outer filter are on different columns in same table.
Can someone else or someone from Microsoft confirm this: filter condition of the calculate function over writes the outer filter condition even when they are on different columns in same table?
Any experts here can shed some light on this?
Hi,
That is because the filter condition of the CALCULATE() function is overriding the implicit filter of the row labels. What result are you expecting?
@Ashish_Mathur The result I'm expecting is that there's value for only May 2023 and other rows should be blank since inner and outer filter context match only for May 2023.
Outer filter is on 'Date'[Month Year] and inner filter is on 'Date'[Date], so my understanding is that in this case inner filter does not override outer filter since they are on different columns in same table.
Could you expand on "overriding the implicit filter of the row labels" ? where can I find more info on this?
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:
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.
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?
Yes, that is what it looks like. Not sure of where this is documented.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
73 | |
57 | |
38 | |
35 |
User | Count |
---|---|
83 | |
68 | |
59 | |
46 | |
45 |