variable
variable

Reputation: 9684

In CALCULATE, what is the difference between using FILTER(ALL...) vs not using FILTER (that is - only using ALL) - example below?

enter image description here

Instead of the above, can we write:

US Sales = CALCULATE(SUM(FactInternetSales[SalesAmount]),ALL(DimSalesTerritory)
                     ,DimSalesTerritory[SalesTerritoryCountry]="United States"
                    )

Upvotes: 0

Views: 86

Answers (1)

Marcus
Marcus

Reputation: 4005

Another one of your questions that can be answered with more or less the same answer: Syntax sugar! Your two queries are identical under the hood.

Also note the difference between the below:

US Sales = 
    CALCULATE ( 
        SUM ( FactInternetSales[SalesAmount] ) ,
        DimSalesTerritory[SalesTerritoryCountry] = "United States"
    )

which is syntax sugar for:

US Sales = 
    CALCULATE ( 
        SUM ( FactInternetSales[SalesAmount] ) ,
        FILTER ( 
            ALL ( DimSalesTerritory[SalesTerritoryCountry] ), 
            DimSalesTerritory[SalesTerritoryCountry] = "United States"
        )
    )

But note that the ALL clause evaluates the single column and not the whole DimSalesTerritory table. Filter context on the other columns in that table are preserved.

Upvotes: 1

Related Questions