Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
newqlikie
Creator
Creator

Compare 2 timeperiods in which first periode is not only in one year

Hi,

now I have the next problem by comparing two time periods. Comparing the periods where all dates are in one year is ok.

Now I have the problem by comparing the periods, where the startdate is one year before the enddate (e.g. startdate 01.10.2010 and enddate is 30.09.2011)

Therefore I need the compared timeperiod one year befor (e.g. startdate 01.10.2009 and enddate is 30.09.2010).

I tried it with following formula without success:

sum({<(JARECDAT >= makedate(year(vMinDatum)-1,month(vMinDatum),day(vMinDatum)) and

           JARECDAT <= makedate(year(vMaxDatum)-1,month(vMaxDatum),day(vMaxDatum)))>} Umsatz)

JARECDAT= Each date of all years (eg. 01.01.2009, 02.01.2009, 03.01.2009 ... 28.09.2011)

vMinDatum = Variable where I pick the startdate

vMaxDatum = Variable where I pick the enddate

Umsatz= turnover, which I trie to compare

Does anyone has an idea?

Thanks for your help.

Regards

    NewQlikie

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

    Try this way.

    sum({<(JARECDAT = {">=$(=Addmonths(vMinDatum,-12))<=$(=Addmonths(vMaxDatum,-12))"}>} Umsatz)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

    Try this way.

    sum({<(JARECDAT = {">=$(=Addmonths(vMinDatum,-12))<=$(=Addmonths(vMaxDatum,-12))"}>} Umsatz)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
newqlikie
Creator
Creator
Author

Thank you very much. That works perfectly!

Regards,

      NewQlikie

Not applicable

Hi newqlikie,

This case seems similar with mine, would you attach the qlikview file, i really need an example .

Thanks