Last answered:

08 Nov 2022

Posted on:

07 Nov 2022


Difference between using filter and calculate filter parameter

I am wondering what is the difference between using FILTER function within CALCULATE and using the filter expression parameter in CALCULATE function
I tried both of them and they return the same output

MW/OFilter = CALCULATE(SUM(fact_InternetSales[SalesAmount]), dim_Product[ProductKey]=528)
MWFilter = CALCULATE(SUM(fact_InternetSales[SalesAmount]), FILTER(dim_Product, dim_Product[ProductKey]=528))

1 answers ( 0 marked as helpful)
Posted on:

08 Nov 2022


The difference is that CALCULATE is a filter modifier, meaning it will modify the existing filtering context. If you use CALCULATE without the FILTER function inside a table with some other arguments such as ProductKey, for ProductKey 528 the value might be 1000, however because you don't have the FILTER function, CALCULATE will modify the values for the rest of the Product Keys to be equal to 1000. Why, because it is modifying the existing filter context. Which is why you should always use CALCUALTE with FILTER.

Submit an answer