Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikhans
Creator
Creator

using variable in formula

Hi,

I have defined a variable vGL_mutatie as sum({$}Debet)-sum({$}Credit). In a pivot table =$(vGL_mutatie) works. Now I want to apply this variable to the formula sum(if (InYear (Boekdatum, Today(), -1), Debet))-sum(if (InYear (Boekdatum, Today(), -1), Credit)).

I tried several varaties, such as :

if (InYear (Boekdatum, Today(), -1, $(vGL_mutatie)))

sum(if (InYear (Boekdatum, Today(), -1, vGL_mutatie)))

who helps me out?

kind regards

Hans

4 Replies
Not applicable

Hi Hans ,

can you try this

if (InYear (Boekdatum, Today(), -1, $(=(vGL_mutatie))))

hope may be it fixs your issue

thanks

Meher

qlikhans
Creator
Creator
Author

Hi Meher,

Sorry, does not fix it. It returns only '-'.

knd rgrds

Hans

Not applicable

Hans ,

Can you try to save the value of vGL_mutatie into another variable and use that variable in the InYear function ,because  while using $(vGL_mutatie) refers to the setanalysis and tries to pull the value from set but where it seems like we can't use setanalysis in a InYear function .

I'm not sure it will work but try to take a chance

thanks

Meher

qlikhans
Creator
Creator
Author

Hi Meher,

too complicated for a novice like me.

Do you think there would be an easy method to add up Debit and Credit while loading the script?

kind regards

Hans