Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
im trying to calculate return on investement for a stock . the formula is : (initial price-currentprice)/initial price
the user wants to know how his return on investment is changing over time. i created a measure to show the
last price for the stock based on the last date in the date slicer filter but it's not working properly
i want the measure to only return the value 144.49 for the maximum selected date in the filter :12-12-2022
another example :
i changed date period to 5-1-2022 ->7-25-2022
the measure in this case should return price 140.82 for last date in the selected range 7-25-2022
Solved! Go to Solution.
Hi @lawada4 ,
Please update the formula of measure [last date close] as below and you can get the correct result... You can find the details in the attachment.
last date close =
var last_date=CALCULATE(MAX('stocks data'[Date]),ALLSELECTED('stocks data'))
return
CALCULATE(SUM('stocks data'[Close]),'stocks data'[Date]=last_date)
Best Regards
Hi @lawada4 ,
Please update the formula of measure [last date close] as below and you can get the correct result... You can find the details in the attachment.
last date close =
var last_date=CALCULATE(MAX('stocks data'[Date]),ALLSELECTED('stocks data'))
return
CALCULATE(SUM('stocks data'[Close]),'stocks data'[Date]=last_date)
Best Regards