Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
martin_hamilton
Creator
Creator

Best Approach to grouping values into a new column

Hi

I have a file which contains multiple rows whereby I am adding 2 columns together (InvoiceNetAmount + InvoiceTaxAmount) to create a new one (InvoiceAmount).

Customer NumberInvoice NumberInvoice Line IDInvoice Net AmountInvoice Tax AmountInvoice Amount
1113.002.005.00
1123.002.005.00
2213.002.005.00

I wish then to sum the columns related to a certain grouping i.e. CustomerNumber and InvoiceNumber to create a new column on the next file I load, the above values would show the following

Customer NumberInvoice NumberInvoice Amount
1110.00
125.00

Is the best approach to create a temporary table which i then join the results of this to the next table I load. Or am I over complicating things?

Any help appreciated - have attached a sample qvw

9 Replies
sunny_talwar

In the script or front end?

martin_hamilton
Creator
Creator
Author

Hi Sunny

In the script - I thought it would be easier doing it that way.

Thanks

Martin

martin_hamilton
Creator
Creator
Author

Saying that I am not sure of best practice in this circumstance.

thanks

Martin

agomes1971
Specialist II
Specialist II

Hi,

please see attached.

HTH

André Gomes

martin_hamilton
Creator
Creator
Author

Hi Andre, Doesnt seem to be any attachment.

Thanks

Martin

agomes1971
Specialist II
Specialist II

martin_hamilton
Creator
Creator
Author

Hi Andre

Thats works in the dashboard but I was looking to have it included in the script - is that possible?

thanks

Martin

sunny_talwar

May be this:

Table:

LOAD [Customer Number],

    [Invoice Number],

    [Invoice Line ID],

    [Invoice Net Amount],

    [Invoice Tax Amount]

FROM

[https://community.qlik.com/thread/233626]

(html, codepage is 1252, embedded labels, table is @1);

Left Join (Table)

LOAD [Customer Number],

    [Invoice Number],

    Sum(RangeSum([Invoice Net Amount], [Invoice Tax Amount])) as [Invoice Amount]

Resident Table

Group By [Customer Number], [Invoice Number];

Capture.PNG

el_aprendiz111
Specialist
Specialist

Hi,

aMOUNT.png