Forum Discussion
BB912554
1 year agoNew Member
Calculate Sumx aggregation - filter context - issue
Dear community, I have following data in Tbl1: TransID Product Volume Price per piece 1 A 10 1 2 B 20 1,1 3 B 40 1,2 I want to have a measure, showing the total of 7...
- 1 year ago
Install DAXDebugOutput and learn how to use EVALUATEANDLOG
lbendlin
Super User
1 year agoYou forgot to remove the TransID filter
M_Test =
CALCULATE(sumx(Tbl1,[Volume]*[Price per piece]),KEEPFILTERS(Tbl1[Product]="B"),REMOVEFILTERS(Tbl1[TransID]))BB912554
1 year agoNew Member
lbendlin : Thanks for your reply. I am still curious, what Power BI is doing in background that following formular is not functioning to get the 70 result in each line of product B:
M_test =
CALCULATE(
SUMX(Tbl1, Tbl1[Volume] * Tbl1[Price per piece]),
ALL(Tbl1[TransID]),
FILTER(Tbl1, Tbl1[Product] = "B")
)
even if I also relax/removefilter from Tbl1 for Product all(Tbl1[Product]), I still get not the desired result. It seems that Power BI is not doing the aggregation (even though it does when I fully remove all filters from the table.?). I searched the internet / geminis, etc.. but not fully sure. Some outer / inner filter context might be a reason, I do not understand why the removal of filters and the sum does not work here.
even if I also relax/removefilter from Tbl1 for Product all(Tbl1[Product]), I still get not the desired result. It seems that Power BI is not doing the aggregation (even though it does when I fully remove all filters from the table.?). I searched the internet / geminis, etc.. but not fully sure. Some outer / inner filter context might be a reason, I do not understand why the removal of filters and the sum does not work here.
Maybe anyone has information on what Power BI is doing it.
- lbendlin1 year ago
Super User
Install DAXDebugOutput and learn how to use EVALUATEANDLOG