Forum Discussion

eduardoa's avatar
eduardoa
Icon for Advocate I rankAdvocate I
1 year ago
Solved

Managing a wrong total result in a visual

Hello,

In the table, we have multiple currencies with corresponding rates.

The total result should simply be the multiplication of [Amount] * [LastRate].

While the total displayed in Excel is correct, Power BI is returning an incorrect result.

Could you please review the attached results from both Excel and Power BI? Any assistance would be greatly appreciated!


  • Rupak_bi's avatar
    Rupak_bi
    1 year ago

    Hi Here is your result

    Hope images are self explainatory. 

     

7 Replies

  • lukiz84's avatar
    lukiz84
    Icon for Memorable Member rankMemorable Member

    Use SUMX

     

    SUMX(YourTable, YourTable[Amount]*YourTable[LastRate])
    • eduardoa's avatar
      eduardoa
      Icon for Advocate I rankAdvocate I

      Thanks but already tried with the same wrong results

  • Hi eduardoa ,

    The simplest way to achieve this is to create a calculated column and then take sum in the matrix. To do it in DAX use below sintex.

     

    Corrected total =

    Var tot_amt = calculate(sum( amount), all(table))

    Return 

    Sumx(table, amount*last rate/tot_amt)*tot_amt

    This will work. If fails, Let me know. I will create table with the image you shared and explain.

      • eduardoa's avatar
        eduardoa
        Icon for Advocate I rankAdvocate I

        Hello Rupak_bi 
        Unfortunately, it didn’t work.
        The calculated column returned no values