my dataset is like this
KPI VALUE TYPE DATE coffee break duration 11 0 30/06/2015 coffee break duration 12 0 31/07/2015 coffee break duration 10 0 30/11/2014 coffee break duration 10 0 31/12/2014 coffee expense 20 1 31/07/2015 coffee expense 20 1 31/12/2014 coffee consumers 15 -1 31/07/2015 coffee consumers 17 -1 31/12/2014
for Type, 0 means minutes, 1 means dollars and -1 means people
I want to get a table like this
KPI Year(date) YTD coffee break duration 2015 11,5 coffee break duration 2014 10 ....
YTD calculation is:
if sum([TYPE]) = 0 then avg([VALUE])
elseif sum([TYPE]) > 0 then sum([VALUE])
elseif sum([TYPE]) < 0 then [last value for the considered year]
end
By [Last value for the considered year] I mean the last entry available, in a year if my table is set to Year, otherwise it has to change dynamically based on what Timespan I want to show.
What can I do to have [last value for the considered year] as a calc field ready to use in my YTD calc?
Many thanks,
Stefania