Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

pedro_alcala
New Contributor

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

Re: Text apostrophe with formula in variable

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)

3 Replies

Re: Text apostrophe with formula in variable

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)

pedro_alcala
New Contributor

Re: Text apostrophe with formula in variable

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!

Re: Text apostrophe with formula in variable

Super, please close the thread by marking correct response.

Best,

Sunny

Community Browser