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: 
Rohan_W
Contributor II
Contributor II

Concatenate string with Column values in table to resolve variable name

Dear Team,

We have a requirement to calculate future values based upon previous month value for which we have created different variable for each month for which value need to be calculated as shown below,

Rohan_W_0-1695385966557.png

As you can see, the variable name created in vSep, vOct, vNov and vDec and we need to add it to the table where it is missing(Highlighted Gray) for that particular month for the table shown below,

Rohan_W_1-1695386110531.png

We have created a column which resolves exact variable name from the existing column values present in the table and we need to resolve it based upon the variable values calculated earlier.

Rohan_W_2-1695386249495.png

If we use $(concat('v'&[MNTH_END.autoCalendar.Month],'')) it shows missing values.

For Ex - We need to resolve vSep value and it should resolve to 1407 value.

Please suggest to achieve the same.

 

 

 

Labels (1)
1 Solution

Accepted Solutions
JGMDataAnalysis
Creator III
Creator III

Try with this:

Pick(
	 Match('v' & [MNTH_END.autoCalendar.Month], 'vJan', 'vFeb', 'vMar', 'vApr', 'vMay', 'vJun', 'vJul', 'vAug', 'vSep', 'vOct', 'vNov', 'vDec')
,
	 $(vJan)
,
	 $(vFeb)
,
	 $(vMar)
,
	 $(vApr)
,
	 $(vMay)
,
	 $(vJun)
,
	 $(vJul)
,
	 $(vAug)
,
	 $(vSep)
,
	 $(vOct)
,
	 $(vNov)
,
	 $(vDec)
)

View solution in original post

7 Replies
JGMDataAnalysis
Creator III
Creator III

How is the variable vMax_Amt defined?

Rohan_W
Contributor II
Contributor II
Author

It is created in script by taking Max of AMT column and using peek function to assign it to that variable.

Thanks and Regards,
Rohan Waje
771500663
JGMDataAnalysis
Creator III
Creator III

In the context of the example I don't understand what the purpose of the Concat function is.
However, you could try the following:

$($(=Concat('v' & [MNTH_END.autoCalendar.Month], '')))

Or directly:
$($(='v' & [MNTH_END.autoCalendar.Month]))

 

 
Rohan_W
Contributor II
Contributor II
Author

The above expression also resulting in null values. Aim here is to resolve the values in variable_list column which has the same name as variable created, ex- vSep should resolve to 1340.

 

variable list vSep have value 1340 as show below,

Rohan_W_0-1695400402334.png

 

The value for vSep in column variable_list should get replaced whit 1340 and similarly it will replace values for other variables vOct,vNov and vDec.

JGMDataAnalysis
Creator III
Creator III

Try with this:

Pick(
	 Match('v' & [MNTH_END.autoCalendar.Month], 'vJan', 'vFeb', 'vMar', 'vApr', 'vMay', 'vJun', 'vJul', 'vAug', 'vSep', 'vOct', 'vNov', 'vDec')
,
	 $(vJan)
,
	 $(vFeb)
,
	 $(vMar)
,
	 $(vApr)
,
	 $(vMay)
,
	 $(vJun)
,
	 $(vJul)
,
	 $(vAug)
,
	 $(vSep)
,
	 $(vOct)
,
	 $(vNov)
,
	 $(vDec)
)
Rohan_W
Contributor II
Contributor II
Author

It worked!!! I had created variables for only vSep, vOct, vNov and vDec and modified your script accordingly.

Rohan_W_0-1695404983922.png

Thank you for your support.

JGMDataAnalysis
Creator III
Creator III

I included all months on purpose, even knowing that not all variables were defined.
If next year you include any of the variables corresponding to the missing months, you will have to modify the measure because it only considers September, October, November and December.
I am glad that you were able to solve the problem with my collaboration.