Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Setting variable value to a value retrieved from resident table?

Hello, is there a way to set a variable value directly to a value retrieved from a resident table, something like this:

SET myVariable = SUM(Quantity) RESIDENT myTable

Thank you,

Jose.

5 Replies
pdumas
Partner - Contributor III
Partner - Contributor III

Hello,

Let myVariable=sum(Quantity);

will assign to myVariable the result of fhe sum.

Qlikview don't care with which table the field has been loaded.

Pierre.

Not applicable
Author

Thank you for replying,

Using the syntax LET myVariable = SUM(Quantity);

Im getting this message:

"Aggregation expressions not allowed in GROUP BY clause"

Thank you in advance,

Jose.

Anonymous
Not applicable
Author

I ran into this too. This is what I did to get my statistic.

mydatasummed:
load sum(MyVariable) as MyVariableSum resident mydata ;

let x = peek('MyVariableSum',0,'mydatasummed');

See if that works for you.

pdumas
Partner - Contributor III
Partner - Contributor III

I can propose another syntax:







mydatasummed:

mapping

'mysum'

as mysum,

sum

(Quantity) as myquantity

resident

If you use the syntax proposed by Tim, do not forget to drop the table

Pierre.

myTable;

let

myvariable=applymap('mydatasummed','myquantity');load

Not applicable
Author

This Works!