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: 
Black_Hole
Creator II
Creator II

Subtraction in Load Statement

Hello all,

I would like to subtract two columns in a load statement and using a Group By.

I find a lot of documentation about the SUM in a Load statement but none about a Difference.

Please could you tell me if it's possible to do that in QVW.

 

Many thanks in advance for your help.

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

If you do need to aggregate on a dimension, let's say Dim1 you could do this.

Load

Dim1,

//Dim2, 

Sum(Value1 - Value2 ) as Value

From MyData

Group by Dim1 ;

 

View solution in original post

4 Replies
Vegar
MVP
MVP

You dont need group by to subtract two fields in a data load.

Load

Dim1,

Dim2, 

Value1 - Value2 as Value

From MyData;

Anil_Babu_Samineni

Perhaps this?

T1:

Load ID, Sales, Sales1 From Table;

Final:

NoConcatenate

Load ID, sum(Sales)-Sum(Sales1) as Diff Resident T1 Group By ID;

Drop Table T1;

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
Vegar
MVP
MVP

If you do need to aggregate on a dimension, let's say Dim1 you could do this.

Load

Dim1,

//Dim2, 

Sum(Value1 - Value2 ) as Value

From MyData

Group by Dim1 ;

 

Black_Hole
Creator II
Creator II
Author

Hello @Anil_Babu_Samineni , @Vegar ,

I tried both solutions and I get the correct amount.

Many thanks for your help!