Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
arsenal1983
Creator
Creator

Transformation of Data crosstable

Hello,

I need to transform my data durig load process by using some kind of crosstable. 

I have data like:

DOC_KEYINVOICE_NOTEXTVOUCHER_FACE_VALUEACOUNTAMOUNT
1200000164-XXXX-20191250036085*eVoucher 5 USD gross FV:2019.01:H5871080-4477
1200000164-XXXX-20191250036085*eVoucher 5 USD gross FV:2019.01:S5871081282,05
1200000164-XXXX-20191250036085*eVoucher 5 USD gross FV:2019.01:S55107003,95
1200000164-XXXX-20191250036085*eVoucher 10 USD gross FV:2019.01:H10871080-20325
1200000164-XXXX-20191250036085*eVoucher 10 USD gross FV:2019.01:H10510700-5,47
1200000164-XXXX-20191250036085*eVoucher 10 USD gross FV:2019.01:S108710811280,47
1200000164-XXXX-20191250036085*eVoucher 30 USD gross FV:2019.01:H30871080-41463
1200000164-XXXX-20191250036085*eVoucher 30 USD gross FV:2019.01:S308710812612,16
1200000164-XXXX-20191250036085*eVoucher 30 USD gross FV:2019.01:S305107005,84
1200000164-XXXX-20191250036085*eVoucher 50 USD gross FV:2019.01:H50871080-20325
1200000164-XXXX-20191250036085*eVoucher 50 USD gross FV:2019.01:H50510700-0,47
1200000164-XXXX-20191250036085*eVoucher 50 USD gross FV:2019.01:S508710811280,47
1200000164-XXXX-20191250036085*eVoucher 60 USD gross FV:2019.01:H60871080-2439
1200000164-XXXX-20191250036085*eVoucher 60 USD gross FV:2019.01:H60510700-0,15
1200000164-XXXX-20191250036085*eVoucher 60 USD gross FV:2019.01:S60871081153,65
1200000164-XXXX-20191250036085*eVoucher 100 USD gross FV:2019.01100110125107287,37
1200000164-XXXX-20191250036085*eVoucher 100 USD gross FV:2019.01:H100871080-4065
1200000164-XXXX-20191250036085*eVoucher 100 USD gross FV:2019.01:H100510700-0,09
1200000164-XXXX-20191250036085*eVoucher 100 USD gross FV:2019.01:S100871081256,09
1200000165-XXXX-20191250036086*eVoucher 5 USD gross FV:2019.01:H5871080-4070
1200000165-XXXX-20191250036086*eVoucher 5 USD gross FV:2019.01:H5510700-4,2
1200000165-XXXX-20191250036086*eVoucher 5 USD gross FV:2019.01:S5871081244,2

 

I expect result:

DOC_KEYINVOICE_NOVOUCHER_FACE_VALUE1101201101255107008710808710811200000164-XXXX-201912500360851200000164-XXXX-201912500360851200000164-XXXX-201912500360851200000164-XXXX-201912500360851200000164-XXXX-201912500360851200000164-XXXX-201912500360851200000165-XXXX-201912500360861200000165-XXXX-201912500360861200000165-XXXX-201912500360861200000165-XXXX-201912500360861200000165-XXXX-201912500360861200000205-XXXX-201912500360871200000205-XXXX-20191250036087

5  3,95-4477282,05
10  -5,47-203251280,47
30  5,84-414632612,16
50  -0,47-203251280,47
60  -0,15-2439153,65
100 107287,37-0,09-4065256,09
5  -4,2-4070244,2
10  3,3-12195731,7
30  -3,4-243901463,4
50  0,3-12195731,7
6063929,87 0,16-2439146,34
5  -8,4-8140488,4
10  17,6-650403902,4
Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Something like this

Table:
LOAD DOC_KEY,
INVOICE_NO,
TEXT,
VOUCHER_FACE_VALUE,
ACOUNT,
AMOUNT
FROM
[..\..\Downloads\VOUCH (1).xlsx]
(ooxml, embedded labels, table is Sheet1);

FinalTable:
LOAD DISTINCT DOC_KEY,
INVOICE_NO,
VOUCHER_FACE_VALUE
Resident Table;

FOR i = 1 to FieldValueCount('ACOUNT')

LET vACOUNT = FieldValue('ACOUNT', $(i));

Left Join (FinalTable)
LOAD DISTINCT DOC_KEY,
INVOICE_NO,
VOUCHER_FACE_VALUE,
AMOUNT as [$(vACOUNT)]
Resident Table
Where ACOUNT = '$(vACOUNT)';

NEXT

DROP Table Table;

View solution in original post

3 Replies
sunny_talwar

Can you delimit your output data so that it can become a little more readable.

image.png

arsenal1983
Creator
Creator
Author

Hi sunny, I've attached the data set - input and output in xlsx have you seen it? Output is in piv sheet, the sample below.

DOC_KEY;INVOICE_NO;VOUCHER_FACE_VALUE;110120;110125;510700;871080;871081
1200000164-XXXX-2019;1250036085;5;;;3,95;-4477;282,05
1200000164-XXXX-2019;1250036085;10;;;-5,47;-20325;1280,47

 

sunny_talwar

Something like this

Table:
LOAD DOC_KEY,
INVOICE_NO,
TEXT,
VOUCHER_FACE_VALUE,
ACOUNT,
AMOUNT
FROM
[..\..\Downloads\VOUCH (1).xlsx]
(ooxml, embedded labels, table is Sheet1);

FinalTable:
LOAD DISTINCT DOC_KEY,
INVOICE_NO,
VOUCHER_FACE_VALUE
Resident Table;

FOR i = 1 to FieldValueCount('ACOUNT')

LET vACOUNT = FieldValue('ACOUNT', $(i));

Left Join (FinalTable)
LOAD DISTINCT DOC_KEY,
INVOICE_NO,
VOUCHER_FACE_VALUE,
AMOUNT as [$(vACOUNT)]
Resident Table
Where ACOUNT = '$(vACOUNT)';

NEXT

DROP Table Table;