Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
shivamkedia
Partner - Contributor II
Partner - Contributor II

storing the value of summission of a column in variable

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.

 

10 Replies
sunny_talwar

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;