Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

POS Data with grouping in Qlikview

Hi all,

I would like to group the value of the Table 1 base on Type to Table 2.

or

is it possible to modify from table 1 to table 3?

Anyway to do it in loading script?

Table 1

ReceiptCodeLineNoTypeValue
10011A10
10012extra cost1
10013extra cost3
10014B12
10021A10
10022B12
10031C20
10032extra cost0
10041B12
10042extra cost2
10043C20
10044extra cost2

Table 2

ReceiptCodeLineNoTypeValue
10011A14
10014B12
10021A10
10022B12
10031C20
10041B12
10043C22

Table 3

ReceiptCodeLineNoTypeValue
10011A10
10012A1
10013A3
10014B12
10021A10
10022B12
10031C20
10032C0
10041B12
10042B2
10043C20
10044C2

Best Regards,

Louis

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Louis

Temp:
LOAD ReceiptCode,
LineNo,
If(Type='extra cost',Peek(Type),Type) as Type,
Value
FROM
"https://community.qlik.com/message/1302513"
(html, codepage is 1252, embedded labels, table is @1);
NoConcatenate
LOAD ReceiptCode,FirstSortedValue(Type,LineNo) as Type,
Sum(Value) as Value,Min(LineNo) as LineNo
Resident Temp
Group By ReceiptCode,Type;
Drop Table
Temp;

Regards,

Antonio

View solution in original post

10 Replies
Anil_Babu_Samineni

I didn't see any Dept field in your table? Would you let us exactly the logic behind

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

I make a mistake.

It should be Type.

Sorry about that.

Many Thanks.

Anil_Babu_Samineni

Oh okay, How A & extra cost clubbed. Are you sure about Output? For me, Expectation is not reachable. Can you explain little more with data and formula to achieve?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi,

Is it possible to modify from table 1 to table 3?


Best Regards,

Louis

Anil_Babu_Samineni

Yes, It is and i got it as below when i use below script

Sample:

LOAD ReceiptCode, LineNo, If(Type='extra cost', 'A', Type) as Type, Value

FROM [https://community.qlik.com/message/1302514]

(html, codepage is 1252, embedded labels, table is @1) Where Value > 0;

Final:

LOAD ReceiptCode, Type, Sum(Value) as Value Resident Sample Group By ReceiptCode,Type;

DROP Table Sample;


Output:

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

It is not only happening in A.

I have edited the table and it should be included all possible cases.

Many Thanks

Anil_Babu_Samineni

I am not sure, What you are talking about? Does my reply is not helpful for you? Because, If you use first part it will return 3rd table and entire script generates the second table. Aren't you?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Your script will turn all "extra cost" to "A".

However, i would like to turn "extra cost" to the type before (other than "extra cost")

Anil_Babu_Samineni

I hope i understand the issue now?

1) Create Flag like If(Type='extra cost', 1, Type)

2) Use Pick(Match(Type, 1), 'extra cost', Type) with Inner Join

3) Then use NoConcatenate for that inner table

You may achieve that as expected

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful