Forum Discussion

findingsolution's avatar
4 years ago
Solved

Card not showing sum

I am trying to get the sum of the column 'Current Cost' in the card called 'Total Value':

 

 

 

If I only select some of the stocks (for example A2M), it will sum the value. But there seems to be problems when I all of them are selected. 

 

Total value is a formula:

Total Value = Stocks[Current Cost]

 

Current Cost is also a formula: 

Current Cost = [Yesterday Close]*SELECTEDVALUE(Stocks[Amount of Shares])
Yesterday Close = CALCULATE ( MAX ( Stocks[Close] ), Stocks[Date] = TODAY() - 1 )
 
The Stocks[Close] data comes from an API from Yahoo finance.
 
Ultimately I want to get the sum of all the current costs, like how they are displayed in the table, but summed in the card instead. How do I get it to work?
 
 

5 Replies

  • YukiK's avatar
    YukiK
    Icon for Impactful Individual rankImpactful Individual

    For Current Cost, try using SUMX() like the following:

     

    Current Cost = 
    SUMX ( 
         VALUES(Stocks[Stock List]),
         [Yesterday Close]*Stocks[Amount of Shares]
    )
    
    • When I try it, it shows an error:

       

       

      That's why I previously used selectedvalue around the amount of shares, but when I try it, the card still does not sum. How do I fix this error?

       

      PS: amount of shares is a whole number.