Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Transaction with different products in one line

Hi everyone,


I am working on a table of transactions (sales). Every row referes to on product that has been bought. The person can buy many products. My goal is to have only one line for each person and add columns for the products that has been bought, knowing that a person can buy no more than 10 products.

I don't know how to make that table in Qlikview starting with an Excel file with a line per product bought.

Thank you.

11 Replies
Not applicable
Author

I achieved the result. However, it has been impossible for me to use the obtained table as it is an object. Could the result be obtained only using the script? Otherwise how can I use the pivot table in another object.

Best regards

Gysbert_Wassenaar

Temp1:

LOAD * INLINE [

    Transaction ID, Product

    1, B

    2, D

    2, F

    2, E

    1, A

    2, A

];

Temp2:

GENERIC

LOAD

     [Transaction ID],    

     'Product ' & autonumber(RecNo(), [Transaction ID]) as ProductNo,

     Product

RESIDENT Temp1

ORDER BY [Transaction ID],Product;

DROP TABLE Temp1;

   Set vListOfTables = ;

   For vTableNo = 0 to NoOfTables()

      Let vTableName = TableName($(vTableNo)) ;

      If Subfield(vTableName,'.',1)='Temp2' Then

         Let vListOfTables = vListOfTables & If(Len(vListOfTables)>0,',') & Chr(39) & vTableName & Chr(39) ;

      End If

   Next vTableNo

   Result:

   Load FieldValue('Transaction ID', RecNo()) as [Transaction ID] AutoGenerate FieldValueCount('Transaction ID');

   For each vTableName in $(vListOfTables)

      Left Join (Result) Load * Resident [$(vTableName)];

      Drop Table [$(vTableName)];

   Next vTableName


talk is cheap, supply exceeds demand