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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
jduluc12
Creator
Creator

Combining data from two rows in load script

Hi,

The data in the table looks something like this.

Item Value Qty
A 10 20
B 11 23
1-A 12 13
1-B 15 16

 

The data in the result table add the numbers for values and qty for similar items and produce something like this.

Item Value Qty
A 22 33
B 26 39
1-A 12 13
1-B 15 16

 

The Value of A is the result of summing up the Value of A and A1, i.e.,

10 + 12 = 22.

The other calculations are done in the same way.

Thanks,

 

Labels (1)
1 Solution

Accepted Solutions
RsQK
Creator II
Creator II

Hi, try something like:

temp:
LOAD * INLINE [
Item|Value|Qty
A|10|20
B|11|23
1-A|12|13
1-B|15|16
] (DELIMITER IS '|');

temp_conc:
NOCONCATENATE
LOAD
SUBFIELD(Item,'-',2) as Item,
Value,
Qty
RESIDENT temp;

INNER JOIN (temp_conc)
LOAD
FIELDVALUE('Item',RECNO()) AS Item
AUTOGENERATE FIELDVALUECOUNT('Item');

CONCATENATE (temp)
LOAD * RESIDENT temp_conc;

DROP TABLE temp_conc;

and then in the frontend just sum the measures:

RsQK_0-1664258325344.png

 

View solution in original post

1 Reply
RsQK
Creator II
Creator II

Hi, try something like:

temp:
LOAD * INLINE [
Item|Value|Qty
A|10|20
B|11|23
1-A|12|13
1-B|15|16
] (DELIMITER IS '|');

temp_conc:
NOCONCATENATE
LOAD
SUBFIELD(Item,'-',2) as Item,
Value,
Qty
RESIDENT temp;

INNER JOIN (temp_conc)
LOAD
FIELDVALUE('Item',RECNO()) AS Item
AUTOGENERATE FIELDVALUECOUNT('Item');

CONCATENATE (temp)
LOAD * RESIDENT temp_conc;

DROP TABLE temp_conc;

and then in the frontend just sum the measures:

RsQK_0-1664258325344.png