Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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 ;
You dont need group by to subtract two fields in a data load.
Load
Dim1,
Dim2,
Value1 - Value2 as Value
From MyData;
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;
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 ;
Hello @Anil_Babu_Samineni , @Vegar ,
I tried both solutions and I get the correct amount.
Many thanks for your help!