Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

When to use LET and SET Statements?

Hello!

Can anyone please tell me when to use LET Statement and SET Statement? I am finding it hard to understand the difference between using the two statements.

Thank you!

3 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

A LET statement will evaluate the expression after the equals sign, whereas a SET statement will put whatever expression you have after the equals sign into your variable.

LET x = max(Date);

will put the value of max(Date) in your variable

SET x = max(Date)

will put the string 'max(Date)' into your variable

rubenmarin

Hi Michael,

SET is used to assign a vlue to a variable 'as is'.

LET is used when the variable is assigned in some calculation

So, if you use

SET var = 1+1 --> var contains '1+1'

LET var = 1+1 --> var contains '2'

ashfaq_haseeb
Champion III
Champion III

Hi,

Check this

let and set difference

Regards

ASHFAQ