Forum Discussion
CharlesRondo
8 years agoFrequent Visitor
Stock prices return graph
Hello, begginer user here! I want to create a line chart with the every day returns of stock prices, the problem for me is that I want it to by dynamic, being able to chose the initial and the end d...
- 8 years ago
Hi CharlesRondo,
In your scenario, you may need three or more date tables due to the start dates are different and independent. Please check out the demo in the attachment. Three measures are like below. (Please note: only F and GM are the same with your requirements here. You can adjust the FCA yourself.)
F = VAR minDate = CALCULATE ( MIN ( Table1[Timestamp] ), ALLSELECTED ( Table1[Timestamp] ) ) RETURN IF ( MIN ( Table1[Timestamp] ) = minDate, 0, DIVIDE ( SUM ( Table1[Trade Close] ), CALCULATE ( SUM ( Table1[Trade Close] ), 'Table1'[Timestamp] = minDate ) ) - 1 )GM = VAR minDate = CALCULATE ( MIN ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) ) RETURN IF ( MIN ( Table1[Timestamp] ) <= minDate, 0, DIVIDE ( SUM ( Table1[Trade Close .1] ), CALCULATE ( SUM ( Table1[Trade Close .1] ), 'Table1'[Timestamp] = minDate ) ) - 1 )FCA = VAR minDate = CALCULATE ( MIN ( Table1[Timestamp] ), ALLSELECTED ( Table1[Timestamp] ) ) RETURN IF ( MIN ( Table1[Timestamp] ) = minDate, 0, DIVIDE ( SUM ( Table1[Trade Close .2] ), CALCULATE ( SUM ( Table1[Trade Close .2] ), 'Table1'[Timestamp] = minDate ) ) - 1 )Best Regards,
Dale
Thejeswar
8 years agoSuper User
Hi,
You can use a Date Slicer that will help you dynamically get the Dates of interest
Like the one below?
