Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
m_perreault
Creator III
Creator III

Using a Variable in a Field Name in an Expression

Hello,

The data I am working with has fields broken down as '2018 Sales' and '2017 Sales'.  I would like to create a variable for current year and use it in my field name within an expression.  For example if my variable vCurrentYear =  max(Year) I would like to be able to use an expression along the lines of  sum("$(vCurrentYear) & Sales") to give me the sum(2018 Sales).  Does anyone know if this possible and how to do it?

Thanks!

Labels (1)
1 Solution

Accepted Solutions
juraj_misina
Luminary Alumni
Luminary Alumni

Or, if you have a variable as you mention, simply Sum([$(vCurrentYear) Sales])

View solution in original post

3 Replies
Digvijay_Singh

May be something like this -

=Sum($(='['&Max(Year)&' Sales'&']'))

juraj_misina
Luminary Alumni
Luminary Alumni

Or, if you have a variable as you mention, simply Sum([$(vCurrentYear) Sales])

m_perreault
Creator III
Creator III
Author

This works perfectly thank you