Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding last two months to next year

Hi All,

I have two fields Year, Month in my data, my requirement is to add last two months to next year (Means my year will start from November).Now i want to filter the data based on Year field. For Ex : Year is 2013 and Month is 11 then it should take Year is 2014 and Month is 1,Year is 2012 and Month is 6 then it should take Year is 2014 and Month is 8.

I did it but when i filter the data i'm getting problem suppose Year is 2013 and Month is 11 If I add the Year filter as 2014 this row also should come.

I have added sample QVW also, Could you please anyone can take a look into this?

Thanks,

Chiru

7 Replies
Not applicable
Author

LOAD

*,

IF (Month + 2 > 12, MakeDate(Year+1,Month+2-12),MakeDate(Year,Month+2)) as FP

Resident Tab1;

Not applicable
Author

And the the file.

Anonymous
Not applicable
Author

Hi,

Kindly check Mr.Henric Blog.

Fiscal Year

This will help you.

Thanks,

Vignesh

Not applicable
Author

Hi Estrada,

Thanks for Your Reply.

But i want filter the data based on year For Ex : year is 2013 and month is 11, If i put filter Year =2014 then this record also should come under 2014.

Could you please help me on this?

Thanks,

Chiru

Not applicable
Author

sc_0105012015.png

the latter is the only one table loaded in memory. Can you explain what behavior you want to achieve with the list boxes in the document: List boxes (Year), (Month) and (FP) those are the only ones you created in the document. explain please.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Arrive a Fiscal calendar in your datamodel, check this link

Fiscal and Standard Calendar generation

Regards,

Jagan.

Not applicable
Author

sc_0205012015.png

Tab1:

LOAD * Inline [

Year,Month,Price

2013,2,200

2013,3,300

2013,4,320

2012,6,230

2012,4,240

2012,5,600

2012,10,500

2013,10,200

2013,11,400

2014,9,900

];

finalresult:

LOAD

*,

IF (Month + 2 > 12, MakeDate(Year+1,Month+2-12),MakeDate(Year,Month+2)) as FP

Resident Tab1;

outer join

load year(FP) as Year ,

      FP

   resident finalresult;

drop table Tab1;