The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Task 4 – Percentage

Task 4 – Percentage

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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.

×
Learn Data Science
this Summer!
Get 50% OFF