Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
khaycock
Creator
Creator

Variables

Any idea why this expression doesn't work?

I feel like the syntax is right but it says it is expecting another '}' somewhere

=sum({$(vYTD)}[Total Revenue])

20 Replies
khaycock
Creator
Creator
Author

Still has the little red line underneath }

khaycock
Creator
Creator
Author

'>=' & vCurrentFiscYearStart & '<=' & Date(Today())

vCurrentFiscYearStart is declared in the master calendar but the date is 1/1/2017

khaycock
Creator
Creator
Author

'>=' & vCurrentFiscYearStart & '<=' & Date(Today())

vCurrentFiscYearStart is declared in the master calendar but the date is 1/1/2017

sunny_talwar

May be this:

=Sum({<DateField = {"$(vYTD)"}>}[Total Revenue])

khaycock
Creator
Creator
Author

Okay that didnt come up with an error but because im trying to show previous years YTD i wanted to include that too.. So I added it in like this:

=Sum({<FiscalYear = {$(vPriorFiscalYear)}, CalendarDate = {$(vYTD)}>}[Total Revenue])

And now I'm getting this error:

error.PNG

Anil_Babu_Samineni

May be use Single colon for Variables. If not use, Double colon

=Sum({<FiscalYear = {'$(vPriorFiscalYear)'}, CalendarDate = {'$(vYTD)'}>} [Total Revenue])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Give this a shot

=Sum({<DateField = {"$(=vYTD)"}>}[Total Revenue])

sasiparupudi1
Master III
Master III

Please look at the following post to see how  to pass parameters to qlikview variables

Qlikview Parameterised Variables

sasiparupudi1
Master III
Master III

Declare variables in script:

Let vCurrentFiscYearStart=MakeDate(2017,1,1);

Let vYTD='>=$'&'(=vCurrentFiscYearStart)<=$'&'(=Date(Today(),''DD/MM/YYYY''))';

put

='$(vYTD)' in a text box to see if you get the correct date filter values

Finally

Sum({<CalendarDate = {'$(vYTD)'}>}[Total Revenue])

hth

Sas

jonnaamb
Contributor III
Contributor III

Hello Kathryn, good day to you

From my experience, I know that variables inside expressions will cause such issues when variables are internally defined within variables. Trying using no variables at all. Put everything into a single expression by not using any variables.

If it works then drill further down by creating a variable this time but make sure it doesn't contain any variables, and go down further. Let me know if it helps.

Best regards,

Ambareesh Jonnavittula