SUMX producing wrong result when filtered in both row context and filter context
Hi there!
Thanks a lot for your responses! Feels good to know that I'm not going crazy 🙂
So first off, I got this reponse from first posting it on the forums. This solution works in this case, but it's creating a whole new table under water, so it feels like taking out an ant with a ballistic missile 😛
Re: SUMX issue when having the same filter in the ... - Microsoft Power BI Community
The reason I used the CALCULATE is to trigger context transition. I need the row context in the calculation to only contain the MLP that the iterator is currently looking at. In order to do that, you have to use CALCULATE.
Your later investigation is correct. Adding the filter as a column removes the issue. The same happens when you remove the owner field from your table, or remove the owner slicer selection. Suddely it works as expected again. It really seems to have something to do with the owner field being part of the slicer and the visual itself. I think that's what's tripping it up.
You say that "The following show how the CALCULATE is removing the MLP filter context for the Rows.", but shouldn't the SUMMARIZE here solve that by aggregating toward the owner and MLP? I'm no DAX expert though, especially not when working with the "DAX behind the DAX", heheh.
When I look at your two pieces of code:
EVALUATE
SUMMARIZECOLUMNS (
'Test Table'[Owner],
'Test Table'[MLP],
TREATAS ( { "1" }, 'Test Table'[Filter] ),
TREATAS ( { "Babymarkt" }, 'Test Table'[Owner] ),
"test_recovery", 'Test Table'[test recovery],
"test_count", 'Test Table'[test count],
"test_no calculate", 'Test Table'[test no calculate],
"test_count_no calculate", 'Test Table'[test count no calculate]
)
EVALUATE
SUMMARIZECOLUMNS (
'Test Table'[Owner],
'Test Table'[MLP],
'Test Table'[Filter],
TREATAS ( { "1" }, 'Test Table'[Filter] ),
TREATAS ( { "Babymarkt" }, 'Test Table'[Owner] ),
"test_recovery", 'Test Table'[test recovery],
"test_count", 'Test Table'[test count],
"test_no calculate", 'Test Table'[test no calculate],
"test_count_no calculate", 'Test Table'[test count no calculate]
)I cannot imagine what would make the first one not work and the second one work. The MLP field is treated exactly the same in both cases.