Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
BVGI
Contributor
Contributor

Calculate the sum of a repeating value

 I have two tables which are joined by "OrderID1". I want to create a table with a total "Verkoopbudget"  for every "Ordernummer". As shown in the image below i have multiple 'Verkoopbudget' for the same "OrderID1".  Is there a way to do this in the Data load editor?

Table 1:

- Ordernummer

- OrderID1

Table 2:

OrderID1

Verkoopbudget

BVGI_0-1664867091661.png

 

 

Labels (1)
1 Solution

Accepted Solutions
Ivan_Bozov
Luminary
Luminary

This was just an example with the data you provided. Everything you need to do is to create a new table with field SUM(Verkoopbudget) AS Verkoopbudget and then use GROUP BY. 

vizmind.eu

View solution in original post

3 Replies
Ivan_Bozov
Luminary
Luminary

Hello! This should do:

Table_1:
LOAD * INLINE [
Ordernummer|OrderID1
2100019|2037
2100021|2039
2100023|2041
2100024|2042
]
(DELIMITER IS '|');

Table_2:
LEFT JOIN (Table_1) LOAD * INLINE [
OrderID1|Verkoopbudget
2037|989,12
2037|250
2039|7048,95
2039|12472,8
2041|720
2041|500
2042|0
]
(DELIMITER IS '|');

Table_3:
NOCONCATENATE LOAD 
	Ordernummer,
	OrderID1,
	SUM(Verkoopbudget) AS Verkoopbudget
RESIDENT Table_1
GROUP BY Ordernummer, OrderID1;

DROP TABLE Table_1;

Ivan_Bozov_0-1664870618061.png

Next time please put a sample data file with your question. 😉

vizmind.eu
BVGI
Contributor
Contributor
Author

Thank you for your solution, but this was only a small sample of the data. As of right now there are hundreds of orders and still growing. So having to manually add data to the inline tables is not what i'm looking for. 

Ivan_Bozov
Luminary
Luminary

This was just an example with the data you provided. Everything you need to do is to create a new table with field SUM(Verkoopbudget) AS Verkoopbudget and then use GROUP BY. 

vizmind.eu