Mastering filter arguments with CALCULATE is critical to having success building measures with DAX in Power BI.
In the most fundamental case, you need to know the difference between how FILTER(ALL()) and FILTER(VALUES()) on a single column produce different results in different filter contexts when used as filter arguments to CALCULATE. You can read my blog on the topic “CALCULATE 102 – Filter ALL or Filter VALUES”.
Once you’ve mastered the “long version” of CALCULATE using a single column filter argument, you can use shortcuts for achieving the same results …and actually understand why!
In the case of FILTER(ALL()), using a simpler “Boolean” filter argument to CALCULATE.
In the case of FILTER(VALUES()), using KEEPFILTERS as a filter argument to CALCULATE.
And once you’ve mastered single column filter arguments, you can expand your expertise to incorporate multi-column filter arguments to CALCULATE, as well.
In a terrific post from SQLBI on KEEPFILTERS called “Using KEEPFILTERS in DAX”, you’ll see how to use FILTER(ALL()), FILTER(VALUES()), KEEPFILTERS and SUMMARIZE to raise your game using CALCULATE to create the measures you need with both single and multi-column filter arguments.