Hello @Rajesh,
That’s really good that you came to know about how the expression and argument actually works under the CALCULATE function.
Lastly, before we sign off from this thread. I would just like to shed some light about how “Result1” is different from the “Result3”.
When we reference the naked table under the FILTER function it firstly generate the whole table virtually. Now, since we’ve haven’t wrapped that table under either under the following function “ALL”, “ALLSELECTED” or “ALLEXCEPT”. It won’t able to recognize which function to adopt by default out of these three. And since it’s not able to categorize which one to use it’ll simply discard the FILTER function as good as making it null and void.
So although our formula may look like this -
VAR Result3 =
CALCULATE( SUM( Sales_Data[Sales] ) ,
FILTER( DateTable ,
DateTable[Date] <= LastVisibleDate ) )
But in actual it’ll be working like this -
VAR Result3 =
CALCULATE( SUM( Sales_Data[Sales] ) )
And that’s why it provides the same result i.e. “Total Sales = Result3”
Had we not used the FILTER( DateTable )
and kept the formula as mentioned for VAR Result1 -
VAR Result1 =
CALCULATE( SUM( Sales_Data[Sales] ) ,
DateTable[Date] <= LastVisibleDate )
Then in that case although we haven’t specified any condition it will by default use ALL and since DateTable[Date] <= LastVisibleDate
condition is mentioned under the FILTER argument it’s as good as mentioned under the FILTER function.
So at back end the formula will actually run like the one provided below -
VAR Result4 =
CALCULATE( SUM( Sales_Data[Sales] ) ,
FILTER( ALL( DateTable ) ,
DateTable[Date] <= LastVisibleDate ) )
Hope now everything is sorted on this thread.
Thanks and Warm Regards,
Harsh