Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

QlikView Day Index

Hi

I know we create a month index from the following in script:

Year($(i)) * 12 + num(Month($(i)),'00') as MonthIndex,

This will help compare current year data up to today with Prev Year Data up to the same day in the prev year.

Any help with a solution will be appreciated

Thank you,

Chris

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Dear Chris,

Sorry but I couldnt understand your requirement.

Can you please explain with some example.

Regards,

Kaushik Solanki

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

Anonymous
Not applicable
Author

Hi Kaushik

I need to compare Value in my model for Current year vs Prior year.

I need to compare for example:

sum({<Year = {"$(vMaxYear)"}>}Value) - which is the sum Value for this year up to 7 March 2016

And want to compare this with

sum({<Year = {"$(vPrevYear)"}, MonthIndex = {"<=$(vPrevMonthIndex)"}>}Value)

This Answer give me the Sum of Value for 2015 up to end of March 2015.

I want to limit this answer to Sum of Value up to 07 March 2015.

Any ideas of how we can do this so we compare vMaxYear with vPrevYear up to day level and not just Month Level?

I think we need to Create a day index in script and then use max and prev in variables... but not sure how to script the DayIndex in backend

Additional Variables:

vMaxYear = max(Year)

vPrevYear = vMaxYear-1

vMaxMonthIndex =max(MonthIndex)

vPrevMonthIndex =vMaxMonthIndex-12

Thank you

Chris Neumann

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You will have to work with dates.

Try this.

Sum({<Date = {">=$(=Addyears(Yearstart(Max(Date)),-1))<=$(=Addyears(Max(Date),-1))"},Year=,Month=>}Sales)

This will give your Previous Year YTD.

Regards,

Kaushik Solanki

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

Thanks, 100%