2 Replies Latest reply: Mar 22, 2010 6:00 AM by Jordi

# YTD in a Graphic Table Simple

Hi
I'm Jordi Santos and I'm a Beginner in QlikView program.

I'm trying to calculate the accumulate value of YTD and the accumulate of 12 month to day.
I can calculate this values with above expression, and that's right.
But when I select one month, I get a wrong value for YTD and 12M, only appear the value of the current month not the accumulate.
What expression I have to use?
I attach an example.

Thanks

• ###### YTD in a Graphic Table Simple

`Hello,for me the easiest (fastest, safest) way is to adapt your load script to do the calculations once and for all:> renamed your import to "TempMesos" to use as a temporary table> then use a load of the temp data, with a formula to keep a running count YTD while in the same year; not the sort & the peek() to get the previous value> totals per year via a second grouping load> delete temporary tableTempMesos:Load * Inline [TheYear,TheMonth,Value2008,1,13873942008,2,13768442008,3,13094042008,4,13661882008,5,13092752008,6,12538052008,7,13516832008,8,8294852008,9,12140272008,10,13986402008,11,13119822008,12,13652472009,1,12882792009,2,12595272009,3,13568292009,4,12104632009,5,12592762009,6,12286952009,7,13156992009,8,8075692009,9,11967962009,10,13345102009,11,12834822009,12,13092582010,1,12570222010,2,1248634];Mesos:LoadTheYear,TheMonth,Value,If(TheYear = Previous(TheYear), Value + Peek('YTD',-1,'Data'), Value) As YTDResidentTempMesosOrder by TheYear,TheMonth;MesosT:LoadTheYear, sum(Value) AS YTotalResidentTempMesosGroup byTheYear;Drop Table TempMesos;Greetings,Piet`