Forum Discussion

o59393's avatar
o59393
Icon for Post Prodigy rankPost Prodigy
3 years ago
Solved

Incorrect total with dax measure

Hi all

 

My dax measure is not returning the correct total.

 

The dax is:

 

 

The column on the left has the correct total, and the one on the right the incorrect total.

 

The measure I use is:

 

Cost What If = 

DIVIDE(
SUM('DB'[Demand]) * 'Sugar Value'[Parameter Value] * 0.01,
1000) 
*
MAX('DB'[Cost per Ton])

 

How can I get the total right?

 

Thanks.

  • o59393 Try this, use the column you have on the rows:

     

    Cost What If = 
    SUMX ( 
       VALUES ( YourTable[ColumnOnRows] ),
       DIVIDE (
          CALCULATE ( SUM ( 'DB'[Demand] ) ) * 'Sugar Value'[Parameter Value] * 0.01,
          1000
       ) 
       *
       CALCULATE ( MAX ( 'DB'[Cost per Ton] ) )
    )

     

     

     

    👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

    If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

3 Replies

  • o59393 Try this, use the column you have on the rows:

     

    Cost What If = 
    SUMX ( 
       VALUES ( YourTable[ColumnOnRows] ),
       DIVIDE (
          CALCULATE ( SUM ( 'DB'[Demand] ) ) * 'Sugar Value'[Parameter Value] * 0.01,
          1000
       ) 
       *
       CALCULATE ( MAX ( 'DB'[Cost per Ton] ) )
    )

     

     

     

    👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

    If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

    • o59393's avatar
      o59393
      Icon for Post Prodigy rankPost Prodigy

      Hi parry2k 

       

      What should i use as the YourTable[ColumnOnRows] within values? I put the table name but I get an error.

       

      Also I put the " ) " afther the 0.01 to close the calculate argument and then divide by 1000

       

      Thanks.