Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply

Card not showing sum

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

 

findingsolution_0-1647901606205.png

 

 

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?
 
 
1 ACCEPTED SOLUTION

@findingsolution 

pls try this

sum = 
SUMX ( 
     VALUES(Stocks[Stock List]),
     [current cost]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
YukiK
Impactful Individual
Impactful 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:

 

findingsolution_0-1647904724134.png

 

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. 

@findingsolution 

pls try this

sum = 
SUMX ( 
     VALUES(Stocks[Stock List]),
     [current cost]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




works a charm, thank you!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.