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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable for YTD

sunindiamaxgro

Hi everyone,

My Requirement is to compare the YTD2016, YTD2015 and YTD2014

I'm trying to create a variable for YTD only for the completed months. Since I'm in the month of January 2016, the YTD calculation should consider the Jan 2015 to Dec 2015 for 2016 Column..

If we are in the month of February then it should give the YTD as Jan 2016 data for 2016 column.

Coming to the 2015 YTD column – it should show us the Jan 2014 to Dec 2014. If we are in the month of Feb it should show JAN 2015 data.

Please find the attached screen shot and the qvw.file

Thanks in advance.

community.png

1 Solution

Accepted Solutions
sunny_talwar

Cleaned up the application a little bit so that it is easier to work with. Look at the two text boxes below and see if they are giving you the range you want based on different selections. If it is then without the (365*....) the expression is working as your would like. For the missing part, would you be able to resolve it yourself?

View solution in original post

6 Replies
marcus_sommer

Here you find many example how to calculate such periods: How to use - Master-Calendar and Date-Values

- Marcus

sunny_talwar

Vinay I am confused. Fro 2016, you want to see Jan 2015-Dec 2015? or 2016?

I would think these until February doesn't come:

2016 -> 01/01/2016 - 01/31/2016?

2015 -> 01/01/2015 - 01/31/2015?

2014 -> 01/01/2014 - 01/31/2014?

Anonymous
Not applicable
Author

Hi Sunny,

If are in the month of January 2016, i want to see YTD as

2016 -> Jan 2015 - Dec 2015

2015 -> Jan 2014 - Dec 2014

If are in the month of Feb2016, then i want to see the YTD as

2016 -> 01/01/2016 - 01/31/2016

2015 -> 01/01/2015 - 01/31/2015

If are in the month of March 2016, YTD as

2016 -> 01/01/2016 - 02/28/2016

2015 -> 01/01/2015 - 02/28/2015

sunny_talwar

Check if the attached seems to be what you are looking for.

Anonymous
Not applicable
Author

Sunny,

I want to create a seperate variables for Year and Month. So that if i select the year as 2015 then i want to see 2015 as current year and previous year as 2014. It should change depending on the year selections. if i make selections in Month then the values should not change as it is YTD.

sunny_talwar

Cleaned up the application a little bit so that it is easier to work with. Look at the two text boxes below and see if they are giving you the range you want based on different selections. If it is then without the (365*....) the expression is working as your would like. For the missing part, would you be able to resolve it yourself?