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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
gerhardl
Creator II
Creator II

Variable in Chart Expression

Hi There,

I have a chart where I want users to be able to select the Month's data they want to look at.

I set up a variable called vSelectMonth with value =GetCurrentSelections([Posted Month])

Then in my chart I use this expression:

Sum({$<[Posted Month]={$(=vSelectMonth)}>}[Trans Amount])

But is is not working (retuns zero).

I've tried adding double and single quotes, no luck.

Would be great if someone can assist (or give me a better way of using specific selections in a chart's expression).

Thanks,

Gerhard

1 Solution

Accepted Solutions
gerhardl
Creator II
Creator II
Author

Hi Facundo,

Just figured out to my problem.

When using "GetCurrentSelections", it returns [FIELD NAME] = [Field Selection], so in this case it returned "Posted Date = Dec".

So I changed my Variable to "GetFieldSelections", which then only returns the Month Name, and now the chart works.

Thanks.

View solution in original post

2 Replies
fdelacal
Specialist
Specialist

hi gerhardl trie without '='

see the lines...

Sum({$<[Posted Month]={$(vSelectMonth)}>}[Trans Amount])

hope it helps you

gerhardl
Creator II
Creator II
Author

Hi Facundo,

Just figured out to my problem.

When using "GetCurrentSelections", it returns [FIELD NAME] = [Field Selection], so in this case it returned "Posted Date = Dec".

So I changed my Variable to "GetFieldSelections", which then only returns the Month Name, and now the chart works.

Thanks.