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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
azucna122
Partner - Creator
Partner - Creator

generate qvd partitions by months with table joins

Hi, I am new to qlik,

I have some qvd partitioned in months, with the format:

Sales_202311.qvd
Sales_202310.qvd
Sales_202309.qvd
Sales_202308.qvd
Sales_202307.qvd
Sales_202306.qvd
... Sales_202301.qvd

I have my code that generates the qvd's like this:
SALES:
LOAD
"SALES_ID",
"NAME_SALES",
"LATEST_DATE_CHARGE" AS LATEST_DATE_CHARGE_SALES
FROM
test.xls
(biff, embedded labels, table is SALES$);

LET vcurrentdate= num(YearStart(Today()));

DO WHILE vcurrentdate <= Today()

ExportTable:
NOCONCATENATE
LOAD *
RESIDENT SALES
WHERE InMonth(LATEST_DATE_CHARGE_SALES, $(vcurrentdate), 0) = true();

LET vdatestring = Date($(vcurrentdate), 'YYYYYMM');
STORE ExportTable INTO [QVDS\SALES_$(vdatestring).QVD] (qvd);
DROP Table ExportTable;

LET vcurrentdate = num(AddMonths($(vcurrentdate), 1));

LOOP

The problem is that I want to make a UNION with other two table (PRODUCTS and CUSTOMER) and that generates the partitions by month like in sales:

PRODUCTS:
LOAD
"ID_PRODUCTS",
"NAME_PRODUCTS",
"LAST_MODIFIED" AS LAST_MODIFIED_PRODUCTS
FROM
test.xls
(biff, embedded labels, table is PRODUCTS$);

Products_202311.qvd
Products_202310.qvd
Products_202309.qvd
Products_202308.qvd ...Products_202301.qvd

CUSTOMER:
LOAD
"CUSTOMER_ID",
"CUSTOMER_NAME",
"DATE_DAY" AS DATE_DAY_CUSTOMER
FROM
test.xls
(biff, embedded labels, table is CUSTOMER$);

Customers_202311.qvd
Customers_202310.qvd
Customers_202309.qvd
Customers_202308.qvd ... Customers_202301.qvd

How can I make a union of the two new tables and still do the partitioning by months?

3 Replies
vincent_ardiet_
Specialist
Specialist

What do you want exactly to concatenate together?

azucna122
Partner - Creator
Partner - Creator
Author

i want to concatenate the qvd's i have generated and have only 1 qvd global

vincent_ardiet_
Specialist
Specialist

You can use "Concatenate" key word to concatenate your 3 tables together, you can also use the same 3 fields (ID, NAME, DATE) for each content and add a 4th one (SOURCE) to identify if the data is coming from sales, product or customers.
It depends really of what you want to do with the result.