Page 1 of 1

Why does this calculate work (and others don't)?

Posted: Wed Apr 22, 2020 11:00 pm
by eriks
I have a small question during the excercises in the book. I cannot figure out why if you use

Customers with Sales Greater Than 5000 = CALCULATE(COUNTROWS(FILTER(Customers;[Total Sales]>=5000)))

is is working well while you put countries on rows and it is not working for

Total Number of Customers = (countrows(Customers))

I understand that you filter customers based on a total sales filter. However, I don't understand why the first formula works while filtering on product category (on rows). In my opinion you if try to filter upstream (from customers to sales to products) it does not work.

Re: Why does this calculate work (and others don't)?

Posted: Sun Apr 26, 2020 7:10 am
by MattAllington
I would not say “works” and “doesn’t work”. They both work, but the first in the visual doesn’t filter and the second does. As you have said, the key difference is the measure inside the formula. The measure receives the filter from the visual in 2 ways. Firstly, simply it is because the rows of a visual filter a measure; that’s how it works. But secondly, there is a more complex action. The filter function has a row context (chapter 10) and the total sales measure creates context transition. So the result is that the customers table is also filtering the result.

Total customers has no embedded measure and no filter path from products to customers

Re: Why does this calculate work (and others don't)?

Posted: Mon May 04, 2020 9:21 pm
by eriks
Thanks for your answer. I understand now that you can filter the customers table based on context transition (only count customers > 5000 dollar). However, this measure is situated in the customers table. So basically you can filter a measure in a lookup table based on another look up table as e.g. country (the rows in the visual)?

Re: Why does this calculate work (and others don't)?

Posted: Tue May 05, 2020 9:00 pm
by MattAllington
Yes. Data tables can filter lookup table, but it doesn’t happen automatically. Read my article here
https://powerpivotpro.com/2014/08/filte ... s-that-is/