Resolved: Doubt on DAX formula
Why can't we use directly,
%SalesUnitedStates = DIVIDE([SalesAmountUnitedStates], [TotalSalesAmount], ALL(dim_SalesTeritory[SalesTerritoryCountry]))*100
As we already have calculated the [TotalSalesAmount].
But I am getting ths error as shown in Attched file.
3 answers ( 1 marked as helpful)
Because the syntax is incorrect, the DIVIDE function is a asking for a nominator, denominator and an alternative result which is optional. The SalesTerritoryCountry is a text field therefore it cannot be an alternative result. We are including it inside the CALCULATE function, so that we are dividing the sales of the United States against the Total Sales Amount for ALL countries. Please use the code shown inside the video.
Thank you so much!
Yes, we can use it directly.
You should just put the [TotalSalesAmount] within the CALCULATE Function:
%SalesAmountUnitedStates = DIVIDE([SalesAmountUnitedStates], CALCULATE([TotalSalesAmount], ALL(dim_SalesTeritory[SalesTerritoryCountry])))*100
You should just put the [TotalSalesAmount] within the CALCULATE Function:
%SalesAmountUnitedStates = DIVIDE([SalesAmountUnitedStates], CALCULATE([TotalSalesAmount], ALL(dim_SalesTeritory[SalesTerritoryCountry])))*100