Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
raghavsurya
Partner - Specialist
Partner - Specialist

Year On Year Comparison

Hi,

we have sales, Cost and Profit data for 3 years 2008, 2009 and 2010. For year 2010 the data is available only until May'10 (5 months). When I do a Year on Year comparison for the Year 2010, we need to show data also for 5 months of 2009 for comparision. For example the expression I am using is for Current year is

=num(((Sum({<Year={$(=Max(Year))} >} AAmount )))) if year 2010 is select it will show data for 5 months (jan to May)

for Previous year YTD I am using the expression

num(((Sum({<Year={$(=Max(Year)-1)} >} AAmount ))) this will show the data for the whole of year.

The requirement is if year 2010 is selected the the previous year data for 2009 should also be selected for first 5 months.

How can this be achieved.

Can somebody please help.

Regards,

Raghav

3 Replies
spsrk_84
Creator III
Creator III

Hi,

Since u need the previous year Amount also i.e suppose if u consider today's date which is Jun-28th u will get the sales happened in this year till that date.but when u consider previous year salesamount u will get all tha sales of that entire year......So what i suggest in the set expression which u had written earlier try to pass the month as well current day so it will be like

year-1=2009,Month<=Month(Today()) ,Day= <=Day(Today())

Like this try to pass the parameters mean while i will try to send the exact expression....

Regards,

Ajay

Not applicable

Hi,

Try this way

Variable=max(month(today())

for Previous year =sum(if(year='2008' and month<=Variable,amount))

current year =sum(if(year='2009' and month<=Variable,amount))

i pass the year directly you please change as per your scenario

try this in set analysis as well ,

Thanks

Naren





tresesco
MVP
MVP

Try using InYearToDate() function. This function is specially made for this purpose.