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

Dynamic variable not working in expression

I have created a variable to get the maximum month of all the selected month.

Variable Name : Max Month

Definition : SubField(GetFieldSelections([Month],',',GetSelectedCount([Month])),',',GetSelectedCount([Month]))

I am trying to use it in a sum function but its not working. Looks like some syntax error.

Please help.

Thing I have tried

=sum({$<Geo={"EUZ"} , Month={$(Max Month)}>} Actual)  --- Error

=sum({$<Geo={"EUZ"} , Month={'$(Max Month)'}>} Actual)  ---- Giving 0 which is not the write answer

=sum({$<Geo={"EUZ"} , Month={$(=Max Month)}>}Actual1) --- Again giving 0

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Anvita,

Try this expression

=sum({$<Geo={"EUZ"} , Month={"$(=$(Max Month))"}>}Actual1)


Or


Add equal sign in the variable definition and try,

=SubField(GetFieldSelections([Month],',',GetSelectedCount([Month])),',',GetSelectedCount([Month]))

View solution in original post

5 Replies
tamilarasu
Champion
Champion

Hi Anvita,

Try this expression

=sum({$<Geo={"EUZ"} , Month={"$(=$(Max Month))"}>}Actual1)


Or


Add equal sign in the variable definition and try,

=SubField(GetFieldSelections([Month],',',GetSelectedCount([Month])),',',GetSelectedCount([Month]))

vinieme12
Champion III
Champion III

Isn't Max (Getfieldselections ([Month])) working ?

May be even Max ([Month])

Why are you using subfield??

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Frank_Hartmann
Master II
Master II

perhaps this:

=sum({$<Geo={"EUZ"} , Month={'=$(=Max Month)'}>}Actual1)

Anonymous
Not applicable
Author

Thanks Tamil Nagaraj !! 

The expression you have given works nicely !

Anonymous
Not applicable
Author

Thanks everyone for your inputs. Much appreciated.