Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
SunilChauhan
Champion
Champion

same day comparisions of two years

i want to compare same day of two year in qlikview

that means if i want sales till 04 jan in 2012

then i want to compare it with 04 jan 2011.

hope someone can helps me

Sunil Chauhan
7 Replies
swuehl
MVP
MVP

You want only the sales for that dates or YTD? I assume latter:

=sum( {<Date = {">=$(=yearstart(Date))<=$(=today())"} >} Sales)

=sum( {<Date = {">=$(=yearstart(Date,-1))<=$(=addmonths(today(),-12))"} >} Sales)


The Date format must match the format returned by yearstart and addmonths, or use num() functions around latter two.

Hope this helps,

Stefan

SunilChauhan
Champion
Champion
Author

i want ytd for  current year and last year

but both till date 01/05/2011

i want comparision of

05 Jan 2012   and 05 Jan 2012

hope you understand

Sunil Chauhan
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi Sunil,

Do you want comparision of 05 jan 2011 and 05 jan 2012 ?

If you want the comparision of selected date value with last year same date value then you can use:

=sum( {<Date = {"$(=Max(Date))"} >} Amount)

=sum( {<Date = {"$(=addmonths(Max(Date),-12))"} >} Amount)

Hope this will help

SunilChauhan
Champion
Champion
Author

thanks steafen and vijay .

@Steafen:

hello steafen you post is  working for me but i  when i click on 03 jan 2012 then it is not working.

so it should also works on other dates not only today

Sunil Chauhan
swuehl
MVP
MVP

Try

=sum( {<Date = {">=$(=yearstart(Date))<=$(=Date(max(Date)))"} >} Sales)

=sum( {<Date = {">=$(=yearstart(Date,-1))<=$(=addmonths(max(Date),-12))"} >} Sales)

Regards,

Stefan

Not applicable

How I do this if I wanted to compare the below dates, both Thursdays from each year.

Do you want comparision of 06 jan 2011 and 05 jan 2012 ?

swuehl
MVP
MVP

Alex, the same weekday, a year back, could probably be calculated like going 52 weeks or 364 days back in time, right?

like

=only({<Date= {'$(=Date(Date-364))'}>} Sales)