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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script reuse

Hey people,

I am trying to build a dashboard which could get the table from some database updated every month. So I have loaded the data of last three month like the chart below:

My script is like

Directory;

LOAD Date,

     June AS M1,

     July AS M2,

     August AS M3

FROM

test1.xls

(biff, embedded labels, table is Sheet1$);

However, the Loading is hard coded. Thus if i want to reload the data table test1 this month, which is updated with information of July, August and Septmber, my reload will fail.

Wondering if there is a way that I can make it work monthly?

Thanks in advance!

Best,

Thomas

1 Reply
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

for the dynamic months, I think you can use something like this:

let M3 = date(today(), 'MMMM');

let M2 = date(addmonths(today(), -1), 'MMMM');

let M1 = date(addmonths(today(), -2), 'MMMM');

load Date,

       $(M3) as M3,

       $(M2) as M2,

        $(M1) as M1

FROM test1.xls (biff, embedded labels, table is Sheet1$);

Hope this helps you.

Regards,

Fernando