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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum subtotals into my data table

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Sum-SubTotals-2011021900.qvw]

Hi guys,

Need help to solve the following situation:

Please see the qvw attached.

I have a table with a list of actions (ACTs) to be done to a specific work order (Serial Key).

The expression "Line Time" gives me the number of minutes I have to work on EACH step (ACT).

In the expression "Line Time Sub Total" I need to calculate the number of minutes of ALL the acts that their position "Pos" value is smaller or equal to the position of the current act, so:

Act, Pos, LineTime, LineTimeSubTotal

100, 10, 1, 1

80, 20, 2, 3

500, 30, 1, 4

and so on...

I have to solve it in the script.

Thanks in advance,

Aldo.

1 Solution

Accepted Solutions
Not applicable
Author

I solved it using RangeSum()... see below.

Aldo.

Chart2_16:
LOAD
'A'
,[Serial Key]
,[Act]
,[Pos]
,[Act Name]
,[Act Des]
,[Total WTime]
,[Total EmpTime]
,[Total LineTime]


,RangeSum(Peek(LineTimeSubTotal),[Total LineTime]) as LineTimeSubTotal


RESIDENT Chart2_17
ORDER BY [Serial Key], Pos;
DROP TABLE Chart2_17;

View solution in original post

1 Reply
Not applicable
Author

I solved it using RangeSum()... see below.

Aldo.

Chart2_16:
LOAD
'A'
,[Serial Key]
,[Act]
,[Pos]
,[Act Name]
,[Act Des]
,[Total WTime]
,[Total EmpTime]
,[Total LineTime]


,RangeSum(Peek(LineTimeSubTotal),[Total LineTime]) as LineTimeSubTotal


RESIDENT Chart2_17
ORDER BY [Serial Key], Pos;
DROP TABLE Chart2_17;