Hi every Body

I Have a Question

I Want to know When we use FILTER Function in CALCULATE Argument

# For Example:

VAR X = MAX(Date[Date])

CALCULATE([Sales],

FILTER (ALL(Date) , Date[Date]<= X))

OR in this video : Simple and advanced filters with CALCULATE using FILTER function

CALCULATE([TotalSale],

FILTER(Product, Product[ProductGroup] = “Top”))

I Know for example for Filtering Measures We can’t Use CALCULATE, But for These Two example I don’t Know Why we should use FILTER Function Inside CALCULATE.