Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone!
Please, we need some help, we are trying to estimate the cumulative sum of sales in the last 12-month build-up but we do not work well. We have 2 fields Date and Ingresos (Sales). Our code is:
=if("Year([Date])"=2008,
if("Month([Date])"='jan' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan"} >} total [Ingresos]),(
if("Month([Date])"='feb' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"mar","apr","may","jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb"} >} total [Ingresos]),(
if("Month([Date])"='mar' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"apr","may","jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar"} >} total [Ingresos]),(
if("Month([Date])"='apr' , sum ({$<"Year([Date])"={2007}, "Month([Date])"={"may","jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr"} >} total [Ingresos]),(
if("Month([Date])"='may' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may"} >} total [Ingresos]),(
if("Month([Date])"='jun' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"jul","aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun"} >} total [Ingresos]),(
if("Month([Date])"='jul' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"aug","sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul"} >} total [Ingresos]),(
if("Month([Date])"='aug' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"sep","oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul","aug"} >} total [Ingresos]),(
if("Month([Date])"='sep' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"oct","nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul","aug","sep"} >} total [Ingresos]),(
if("Month([Date])"='oct' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"nov","dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul","aug","sep","oct"} >} total [Ingresos]),(
if("Month([Date])"='nov' , sum({$<"Year([Date])"={2007}, "Month([Date])"={"dec"} >} total [Ingresos]) + sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov"} >} total [Ingresos]),(
if("Month([Date])"='dec' ,sum ({$<"Year([Date])"={2008}, "Month([Date])"={"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"} >} total [Ingresos])))))))))))))))))))))))))
Thank you!!!
Hi
This link should provide you with some ideas: http://community.qlik.com/forums/t/29231.aspx
Also, as Oleg says in the above link, there are many other examples in this forum discussing 12 month rolling values, just do a search for 12 month rolling and take a look.
Regards,