Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
soha1902
Creator
Creator

Expression in Variable

Hi All,

I hve below expression 

sum({<
[Date]={"$(=date(max( { 1 < Month_Name={"$(=MonthName(AddMonths([Date],-1)))" } >} [Date] ), 'YYYY-MM-DD'))"}
>}Amount)

Now I want to copy this expression in variable and need to use variable in chart expression but as this expression already contains " (Quote), I am not able to store it in variable.

Can anyone help me to do the same.

4 Replies
sunny_talwar

@soha1902 Why are you not able to store this in a variable if there are quotes? I don't think variables have issues with quotes

soha1902
Creator
Creator
Author

Hello @sunny_talwar , Actually in variable we need to add "" before and end of the expression like

vAmount = "sum({<
[Date]={"$(=date(max( { 1 < Month_Name={"$(=MonthName(AddMonths([Date],-1)))" } >} [Date] ), 'YYYY-MM-DD'))"}
>}Amount)"

but above expression throws error in front end when I am defining the vAmount variable.

sunny_talwar

@soha1902 Are you doing this in the script?

soha1902
Creator
Creator
Author

No in .txt file and using variables in qlik expression.