Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can anyone please help me out with the question discussed below

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 anyone please help me...!!

3 Replies
maxgro
MVP
MVP

why CREATION_DATE2? and also the variables are changed in the expressions

maybe

= sum({<CREATION_DATE1 = {">=$(vpreviousstartyear)<=$(vpreviousyear)"}>}

PO_LINE_LOCATIONS_ALL.QUANTITY)

Not applicable
Author

I tried taking creation_date, it is showing Previous YTD as '0'.

So I have mentioned

date(CREATION_DATE) as  CREATION_DATE1,

  date(AddYears((CREATION_DATE),-1)) as CREATION_DATE2.

For this I am getting same data for both Present YTD and Previus YTD

Not applicable
Author

Please ping me, if there are any doubts in the question.

Thanks & Regards,

varun