Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi guys,
I understand that my question has been asked 1000 times and I tried to apply some of the proposed solutions to my problem, but I guess I am just too stupid....
My basic data model:
Table "Share Price" contains share price information on a daily basis:
Table "Portfolio" contains the information of my portfolio:
My problem now is, that the column total is wrong for "Current Value" and "Current Stock Price":
I tried many different things, so far no luck. Here is my DAX for "Current Value"
Current Value =
var Stock_Price = CALCULATE (
CALCULATE (
MAX ('Share Price'[fxYahoo.Close] ),
FILTER (
'Share Price',
'Share Price'[fxYahoo.Date]
= CALCULATE (
MAX ('Share Price'[fxYahoo.Date]),
ALLEXCEPT ('Share Price','Share Price'[Symbol] )
)
)
)
)
var _value = SUM('Portfolio'[#Shares]) * Stock_Price
return
SUMX(Portfolio,if(Portfolio[Paid Price]>0,_value))
I am sure there is an easy fix to this, but I can't figure it out. Could you please lend me a hand?
Solved! Go to Solution.
Rename your existing Current Value measure to Current Value ( individual ) then create a new measure
Current Value = IF( ISINSCOPE( Portfolio[Symbol] ), [Current Value ( individual )],
SUMX( ADDCOLUMNS( SUMMARIZE( Portfolio, Portfolio[Symbol]),
"@value", CALCULATE( [Current Value ( individual )] ) ),
[@value]
) )
Not sure what summarization you want for the current stock price, but you could replace the SUMX with AVERAGEX or whatever you need
Rename your existing Current Value measure to Current Value ( individual ) then create a new measure
Current Value = IF( ISINSCOPE( Portfolio[Symbol] ), [Current Value ( individual )],
SUMX( ADDCOLUMNS( SUMMARIZE( Portfolio, Portfolio[Symbol]),
"@value", CALCULATE( [Current Value ( individual )] ) ),
[@value]
) )
Not sure what summarization you want for the current stock price, but you could replace the SUMX with AVERAGEX or whatever you need
Dear @johnt75
Great, that worked. Thank you very much!!
For the "current Stock Price" I didn't want to have a total at all...
May I ask to elaborate a bit why this is working or please point me where I can get a better understanding?