Last answered:

08 Sept 2024

Posted on:

09 Mar 2023

0

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)
Instructor
Posted on:

10 Mar 2023

0

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.

Posted on:

10 Mar 2023

1

Thank you so much! 

Posted on:

08 Sept 2024

0
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

Submit an answer