Last answered:

15 Jun 2020

Posted on:

09 Apr 2020

0

Task 4 - Percentage

Hi;

In the task 4 we create this measure:

1 %SalesAmountUnitedStates = DIVIDE([SalesAmountUnitedStates];

2 CALCULATE(SUM(fact_InternetSales[SalesAmount]); ALL(dim_SalesTerritory[SalesTerritoryCountry])))*100

I will like to know, if we already create 2 additional measures, why we didn't simplify as this:

%SalesAmountUnitedStates = DIVIDE([SalesAmountUnitedStates];[TotalSalesAmount])*100
1 answers ( 0 marked as helpful)
Instructor
Posted on:

15 Jun 2020

0
This is because TotalSalesAmount works with the current filter context. We won't be able to get the correct result because of the way DAX works. If we divide SalesAmountUnitedStates by TotalSalesAmount, the formula engine would divide each row for SalesAmountUnitedStates vs Every Row of Sales Amount instead of the SUM of SalesAmount as a whole. This is why we are using the ALL function, it ignores the row context and provides a steady value for each row.

Submit an answer