Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
12 | |
10 | |
6 |