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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Bala_s
Contributor III
Contributor III

Year wise Qvd dynamically

Hi Experts,

Need help here....

I have data month-wise for 3 years and i need to create qvd's year-wise dynamically with the suffix name of qvd as Year name like below.

abc_2015

abc_2016

abc_2017

abc_2018.

Please help me here to get expected result....

Regards,

Bala 

9 Replies
adityaakshaya
Creator III
Creator III

Hi Bala,

Considering Data is one file for 3 Years then

For i = 2015 to 2018

ABC:

Load * from <FileName> where Year = $(i)

Store ABC into <PathName>abc_$(i);

Drop table ABC;

Next i

Regards,

Akshaya

PS- Mark response as Correct/Helpful if you find it.

Bala_s
Contributor III
Contributor III
Author

‌Hi Akshaya,

Thanks for revert...

It’s not like data is only for 3 years, it may increase year on year.

so how to make it dynamic to store 1 year data into one qvd and so on....

Regards,

Bala

adityaakshaya
Creator III
Creator III

Hi Bala

There are two different approach you can take.

1.  This will run every time and create all year qvds every reload( if there is a data change in previous year then use this)

For i = 2015 to Year(Today())

ABC:

Load * Inline [

A

1

2

3

4

5

];

Store ABC into ABC_$(i).qvd(qvd);

DROP Table ABC;

NEXT i;

2. The below will only store the current year qvd.( if there is no data change in previous year then use this)


Let i = Year(Today());

ABC:

Load * Inline [

A

1

2

3

4

5

];

Store ABC into ABC_$(i).qvd(qvd);

DROP Table ABC;


Hope this helps you.


Regards,

Akshaya

Bala_s
Contributor III
Contributor III
Author

‌Hi Akshay,

In my case data is changing for previous years also so I used 1.

The above script for i =2015 to Year(Today())

gives 4 qvds Yearwise as file name but each file holds all year data.

For ex: Qvd got created with the name as Abc_2015 but in this file data holds from 2015 to current year.

splitting of data is not happenin.

pls help her.....

Bala_s
Contributor III
Contributor III
Author

Hi Akshaya,

In my case the data is changing for Previous Year also so used 1.

In above script, i =2015 to Year(Today())

Year wise qvd is getting created but data holds for complete year.

For ex: Abc_2015.qvd got created but in this file data holds from 2015 to current year.

My expectation is, under  Abc_2015.qvd only 2015 data should be there and so on like Abc_2016.qvd....

Please help here....

Regards,

Bala

big_dreams
Creator III
Creator III

Hi bala250993,

adityaakshaya‌ gave you correct and generalize solution now you have to modify it as per your need.

if you want restrict data for particular qvd then use where clause while loading data.

like

For i = 2015 to Year(Today())

ABC:

Load * Inline [

A

1

2

3

4

5

] where A=$i;

Store ABC into ABC_$(i).qvd(qvd);

DROP Table ABC;

NEXT i;

Regards,

adityaakshaya
Creator III
Creator III

Hi Bala,

You can customize and use it the way Max has mentioned. Just add where condition.

Regards,

Akshaya

adityaakshaya
Creator III
Creator III

Hi Bala,

If you get the solution, request you to mark response as correct. This helps other to see as answered question.

Regards 

Bala_s
Contributor III
Contributor III
Author

Thanks for your help....:)