Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

pulling sql's one month data in qlikview

Hi Experts,

i have a sql table which has 2015 whole data.

from this table, i want to load monthly datas in qlikview and store in qvd.

Sql date format is like 'YYYY-MM-DD'

How can i do this.

Please help.

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: pulling sql's one month data in qlikview

Perhaps like this:

Temp:

LOAD *, Month(MyDate) as Month

SQL Select * From My2015Table;

For i=1 to 12

     MonthlyData:

     Load * Resident Temp Where num(Month) = $(i);

   

     Store MonthlyDate into MonthlyData2015_$(i);

     Drop Table MonthlyData;

next


talk is cheap, supply exceeds demand
2 Replies
MVP & Luminary
MVP & Luminary

Re: pulling sql's one month data in qlikview

Perhaps like this:

Temp:

LOAD *, Month(MyDate) as Month

SQL Select * From My2015Table;

For i=1 to 12

     MonthlyData:

     Load * Resident Temp Where num(Month) = $(i);

   

     Store MonthlyDate into MonthlyData2015_$(i);

     Drop Table MonthlyData;

next


talk is cheap, supply exceeds demand
Highlighted
Partner
Partner

Re: pulling sql's one month data in qlikview

Hi,

1) load the distinct date field

2) create one variable to get the no of rows in the table

3) use for loop

4) in for loop to pass the query and use the where condition to load only particular month data only

5) create a qvd. qvd name should be QVDNAME_MONTH

------------------------------------------

Temp:
LOAD DISTINCT
  Date AS Date_Temp
FROM
query;

LET v_nr_folders = NoOfRows('Temp');


FOR i=0 to $(v_nr_folders)-1

LET v_Date = Peek('Date_Temp',$(i),'Temp');

QUERY
SQL SELECT *
FROM TABLE NAME WHERE Date = '$(v_Date)';


STORE TableName into Path\$(v_File_Name).qvd;

drop table TableName;

next