Forum Discussion
Sachy123
5 years agoHelper V
Calculate daily returns
I have a data in the following format Date Price 15-12-20 100 14-12-20 50 13-12-20 20 12-12-20 10 I would like to create a measure that can calculate daily re...
- 5 years ago
Sachy123 , Try new column like
new column =
var _max = maxx(filter(table, [Date] < earlier([Date])),[Date])
return
[Price] - maxx(filter(table, [Date] = _max),[Price])
or
new column =
var _max = maxx(filter(table, [Date] < earlier([Date])),[Date])
var _1 = maxx(filter(table, [Date] = _max),[Price])
return
divide([Price] - _1,_1)
amitchandak
5 years agoSuper User
Sachy123 , Try new column like
new column =
var _max = maxx(filter(table, [Date] < earlier([Date])),[Date])
return
[Price] - maxx(filter(table, [Date] = _max),[Price])
or
new column =
var _max = maxx(filter(table, [Date] < earlier([Date])),[Date])
var _1 = maxx(filter(table, [Date] = _max),[Price])
return
divide([Price] - _1,_1)