Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Table A:
ColumnName1,colmnName2
a 2
b 3
c 4
vVariable1=sum(columnName2) where columnName1=(a and b) i.e. vVariable1=5
i want sum (columnName2) with where condition(columnName2=a and b) and store into an variable vVariable1.
Here is the alternative
Table:
LOAD * INLINE [
ColumnName1, colmnName2
a, 2
b, 3
c, 5
];
TempTable:
LOAD Sum(colmnName2) as SumAB
Resident Table
Where Match(ColumnName1, 'a', 'b');
LET vSumAB = Peek('SumAB');
DROP Table TempTable;
FinalTable:
LOAD *,
colmnName2 - $(vSumAB) as Result
Resident Table;
DROP Table Table;
May be create a variable like this
Sum({<columnName1 = {'a', 'b'}>} columnName2)
All Things must be in Script.
This will work in script..???
I am not sure I understand... are you looking to use this value in the script?
yes.
Can you elaborate on how you are planning to use this in the script?
May be try this
Table:
LOAD * INLINE [
ColumnName1, colmnName2
a, 2
b, 3
c, 5
];
Left Join (Table)
LOAD Sum(colmnName2) as SumAB
Resident Table
Where Match(ColumnName1, 'a', 'b');
FinalTable:
LOAD *,
colmnName2 - SumAB as Result
Resident Table;
DROP Table Table;