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: 
dmohanty
Partner - Specialist
Partner - Specialist

Last 12 Months from QVD (in Load Script)?

Hi All,

I have a Month/Year field in a Fact QVD (I have multiple Transnational Fields as well), where I have last 18 Months (Jan - 15, Dec - 14, Nov - 14, Oct - 14...... Aug - 13). Now while Loading into Script, I want to fetch only last 12 months.

What would be the logic to write in Load Script?

7 Replies
Anonymous
Not applicable

You should be able to adapt this to your needs :

     Where monthstart([YourMonthYear])  >= monthstart(addmonths(today(),-12))

its_anandrjs

Hi,

Provide the sample file and did you have single fields as Month or year.

Regards,

Anand

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Bill,

Thank you very much. Am checking it now.

But one query please-

Will this condition monthstart(addmonths(today(),-12)) ignore the Current Month? (I don't need Feb - 15, need Jan - 15 and backwards).

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Anand,

The field is like this below. I need last 12 months from this:  Jan-15 and backwards.


its_anandrjs

Hi,

Then in the load script write this script

LOAD

MonthYear

FROM Source;

Where MonthYear  >= (Addmonths(Today(),-13));

Regards

Anand

Anonymous
Not applicable

     Where monthstart([YourMonthYear])  >= monthstart(addmonths(today(),-13))

     and     monthstart([YourMonthYear]) <= monthend(addmonths(today(),-1))

Anonymous
Not applicable

Hi,

try:

Load *
from DataQVD.qvd(qvd)
where Date >= AddMonths(Monthend(today()),-13) and Date < Monthstart(today())

Regards

Neetha