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

POWER BI TASK 4

POWER BI TASK 4

0
Votes
1
Answer

%TotalAmountSales = DIVIDE([TotalSalesAmount],
CALCULATE(SUm(fact_InternetSales[SalesAmount]),ALL(dim_SalesTeritory[SalesTerritoryCountry]),ALL(dim_SalesTeritory[CountryOrder])))
 
%SalesUnitedstates = DIVIDE([SalesAmountUnitedStates],
CALCULATE(SUM(fact_InternetSales[SalesAmount]),ALL(dim_SalesTeritory[SalesTerritoryCountry])))
Why did we use CALCULATE in both of these DAX equations wherein why can’t we choose the denominator as TotalSales ?

1 Answer

365 Team
0
Votes

Hey Venkat,
Because we need to remove specific filters from our calculation, otherwise we will not get the correct numbers. Imagine this, the SUM of SalesAmount would SUM the whole column, but when it needs to divide against itself it would return 1. Because DAX calculates row by row. So we want column A1 to divide against the sum of A1 to A20. That’s why we need to apply ALL function to the denominator. We cannot use ALL on its own with SUM so we use CALCULATE. I hope this makes sense.

×
LAST CHANCE
Ready to Learn Data Science?
50% OFF