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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Parameterized variables (optional parameter)

I want to create a parameterized variable to does something like this:

sum($1*$2)

however, I want the second parameter to be optional, so if $2 was not provided, it would just be sum($1).  I tried using an if(isnull($2)) with two separate functions, but that seems to evaluate the field passed in $2 and provided very wierd answers when i didn't pass a value in the second parameter.  Is there a QV function to test if a parameter was passed?

Labels (1)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try :

Sum($1*alt($2,1))

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

1 Reply
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try :

Sum($1*alt($2,1))

Best,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!