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

How to get previous Year to date by using the below scenario?

Hi,

This is Varun.

I actually have a small question. I have created 4 variables,

1. vpresentyear=(addmonths(date(now()),-((year(now() )-Year)*12)))

2. vstartyear=YearStart(vpresentyear)

3. vpreviousyear=(addmonths((vpresentyear),-12))

4. vpreviousstartyear=YearStart(vpreviousyear)

My requirement is to get  data between (vstartyear and  vpresentyear ) and (vpreviousstartyear and  vpreviousyear) using the variables.

My code for Present Year-to_date is:

= count({<CREATION_DATE1 = {">=$(=vstartyear)<=$(=vpyear)"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)

My code for Present Previous Year-to_date is:

= count({<CREATION_DATE2 = {">=$(=vprevstartyear)<=$(=vprevyear)"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)

I am getting values for Present Year-to_date, but Previous Year-to_date is showing as '0'.

Can you please help me...!!

6 Replies
MK_QSL
MVP
MVP

Provide sample data..pls.

preminqlik
Specialist II
Specialist II

hi there, if i understood , try below one ...keep it in require variable..

count({<CREATION_DATE1={">=$(=makedate($(=max(Year)-1))<=$(=makedate($(=max(Year)-1,max(Month),max(Day)))"},Year=,Month=,Day=>}PO_LINE_LOCATIONS_ALL.QUANTITY)

SunilChauhan
Champion
Champion

if you are using year over year comparision then use formula like below,

Create num(Month(CREATION_DATE1 )) as MonthNo  and Year(CREATION_DATE1 )) as Year



and use below for current Year


count({<Year= {$(=Max(Year))},MonthNo  ={"<=$(=Max(MonthNo) )"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)


and


for previous Year


count({<Year= {$(=Max(Year))},MonthNo  ={"<=$(=Max({<Year{$(=Max(Year))-1}>}MonthNo) )"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)




hope this helps

Sunil Chauhan
Not applicable
Author

Hi Chauhan,

Thanks for your reply.My requirement is to obtain sum(amount) between (Present-Year-To-Date and Previous-Year-to-date) using straight table. Can you please help me out.

Thanks & Regards,Varun

Date: Sat, 12 Jul 2014 04:48:06 -0400

From: qcwebmaster@qlikview.com

To: varunreddykancharla@outlook.com

Subject: Re: - How to get previous Year to date by using the below scenario?

Qlik Community

How to get previous Year to date by using the below scenario?

reply from chauhans85 in New to QlikView - View the full discussion

if you are using year over year comparision then use formula like below,

Create num(Month(CREATION_DATE1 )) as MonthNo and Year(CREATION_DATE1 )) as Year

and use below for current Year

count({<Year= {$(=Max(Year))},MonthNo ={"<=$(=Max(MonthNo) )"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)

and

for previous Year

count({<Year= {$(=Max(Year))},MonthNo ={"<=$(=Max({<Year{$(=Max(Year))-1}>}MonthNo) )"}>}PO_LINE_LOCATIONS_ALL.QUANTITY)

hope this helps

Reply to this message by replying to this email, or go to the message on Qlik Community

Start a new discussion in New to QlikView by email or at Qlik Community

Following How to get previous Year to date by using the below scenario? in these streams:

Inbox

© 1993-2014 QlikTech International AB

Copyright & Trademarks | Privacy | Terms of Use | Software EULA

Not applicable
Author

Hi Prem,

Thanks for your reply.My requirement is to obtain sum(amount) between (Present-Year-To-Date and Previous-Year-to-date) using straight table. Can you please help me out.

Thanks & Regards,Varun

Date: Sat, 12 Jul 2014 04:31:01 -0400

From: qcwebmaster@qlikview.com

To: varunreddykancharla@outlook.com

Subject: Re: - How to get previous Year to date by using the below scenario?

Qlik Community

How to get previous Year to date by using the below scenario?

reply from Prem Kumar Thangallapally in New to QlikView - View the full discussion

hi there, if i understood , try below one ...keep it in require variable..

count({<CREATION_DATE1={">=$(=makedate($(=max(Year)-1)<=$(=makedate($(=max(Year)-1,max(Month),max(Day)))"}PO_LINE_LOCATIONS_ALL.QUANTITY)

Reply to this message by replying to this email, or go to the message on Qlik Community

Start a new discussion in New to QlikView by email or at Qlik Community

Following How to get previous Year to date by using the below scenario? in these streams:

Inbox

© 1993-2014 QlikTech International AB

Copyright & Trademarks | Privacy | Terms of Use | Software EULA

Not applicable
Author

Hi Manish,

Thanks for your reply.My requirement is to obtain sum(amount) between (Present-Year-To-Date and Previous-Year-to-date) using straight table. Can you please help me out.

Thanks & Regards,Varun

Date: Sat, 12 Jul 2014 03:44:08 -0400

From: qcwebmaster@qlikview.com

To: varunreddykancharla@outlook.com

Subject: Re: - How to get previous Year to date by using the below scenario?

Qlik Community

How to get previous Year to date by using the below scenario?

reply from Manish Kachhia in New to QlikView - View the full discussion

Provide sample data..pls.

Reply to this message by replying to this email, or go to the message on Qlik Community

Start a new discussion in New to QlikView by email or at Qlik Community

Following How to get previous Year to date by using the below scenario? in these streams:

Inbox

© 1993-2014 QlikTech International AB

Copyright & Trademarks | Privacy | Terms of Use | Software EULA