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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Text apostrophe with formula in variable

Hello,

I have the following problem and I can't find a solution. I have defined the next variable in the variable interface:

vActualMonth

Definition:

'P08'

I have introduced the ' apostrophe symbol because I'm using this variable value in the following formula in order to select this single month in the addition:

Sum({$<Month_Key_PL={$(vActualMonth)}>}Sales)

If I don't introduce this ' in the variable, the addition doesn't work.

Now I want to automate this variable and i have defined it with this formula:

=Pick(1,[Actual Month])

I have the current month P08 selected but without apostrophe ' and the Sum formula doesn't work. I have tried different ways to include this apostrophe:

='''&Pick(1,[Actual Month])&'''          -->  apostrophe in apostrophe

="'"&Pick(1,[Actual Month])&"'"        -->  apostrophe in quotations marks

These solutions didn't work.

Someone can help me with this issue? How can include an apostrophe and a formula together?

Thank you so much!

1 Solution

Accepted Solutions
sunny_talwar

Not sure, but seems like you are complicating your expression... have you tried this?

Sum({$<Month_Key_PL= p([Actual Month])>}Sales)

If you still want to go the variable route, may be try this

=Chr(39) & Pick(1, [Actual Month]) & Chr(39)

View solution in original post

3 Replies
sunny_talwar

Not sure, but seems like you are complicating your expression... have you tried this?

Sum({$<Month_Key_PL= p([Actual Month])>}Sales)

If you still want to go the variable route, may be try this

=Chr(39) & Pick(1, [Actual Month]) & Chr(39)

Anonymous
Not applicable
Author

I have used a drop down menu linked to this variable and the variable is used in a chart where I can compare and see differences between months. The variable shows the actual month as default but I can change this variable with the drop down menu to do comparisons between the months that I want.

Thank you, Your solution works!

sunny_talwar

Super, please close the thread by marking correct response.

Best,

Sunny