Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tka_ovako
Contributor II
Contributor II

Filtering previous month from data

Hello.

Is there any way to get only previous month data from data I get from attached qvw? Now I get all data but I want to filtering only previous month data. I need to get those previous month values to Nprint report.

Br.

Timo

1 Solution

Accepted Solutions
sunny_talwar

May be change this to

LET v.nrp_starttime = TimeStamp(MonthStart(Today(), -1), 'MM.DD.YYYY hh:mm:ss');

LET v.nrp_endtime = TimeStamp(MonthStart(Today()), 'MM.DD.YYYY hh:mm:ss');

This will pull you just the month of Dec 2016 when we are in Jan 2017. When Feb begins, the above should bring you Jan 2017. Is this what you want?

View solution in original post

4 Replies
sunny_talwar

You want to restrict the data in the script?

tka_ovako
Contributor II
Contributor II
Author

Should I change something in here?

// Folder for output QVDs use
LET vL.QVDPath = 'C:\Users\tka\Desktop\QVD_Generator';

// Starttime parameter for data loads, current day -4 months
LET v.nrp_starttime = timestamp(AddMonths(today(), -4), 'MM.DD.YYYY hh:mm:ss');

// Endtime parameter for data loads, timestamp of current moment
LET v.nrp_endtime = timestamp(now(), 'MM.DD.YYYY hh:mm:ss');

// Interval parameter
LET v.nrp_interval = 2001;

stabben23
Partner - Master
Partner - Master

First, create a datamodel without sync keys.

should this be dynamic so it will always show previous month? if so create  variables which hold this info then use the variable in a where statment.

If you want a Object from Your qvw to be present in Nprinting, then build separate Objects inside GUI With set analysis and previous month in your Expression.

Let vPreviousMonthStart = =monthstart(AddMonths(today(),-1)) ; will hold 2016-12-01

Let vPreviousMonthEnd =monthend(AddMonths(today(),-1)) ; will hold 2016-12-31

sunny_talwar

May be change this to

LET v.nrp_starttime = TimeStamp(MonthStart(Today(), -1), 'MM.DD.YYYY hh:mm:ss');

LET v.nrp_endtime = TimeStamp(MonthStart(Today()), 'MM.DD.YYYY hh:mm:ss');

This will pull you just the month of Dec 2016 when we are in Jan 2017. When Feb begins, the above should bring you Jan 2017. Is this what you want?