Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Dano
Contributor II
Contributor II

How to accept NULL values in parameter?

Hi,

I have a variable with parameters like following:

vMyVariable

=Sum({$<[Condition1] = {'abc'},[Condition2] = {$1}>}$2)

now, in one instance I would like to call this variable and make it ignore Condition2 (accept also not existing values).

I could write set analysis like this:

=Sum({$<[Condition1] = {'yes'},[Condition2] = >}Sales) that would do the trick, but I cannot figure out how to use it with parameter.

vMyVariable(,Sales) returns 0

vMyVariable(*,Sales) would take only fields with any value in Condition2 and I will be missing values where Condition2 is NULL.

(Condition2 is in dimension table and doesn't exists for some lines)

Do you know any of any way how to call this parameter?

1 Solution

Accepted Solutions
andrey_krylov
Specialist
Specialist

Try this expression for a variable

Sum({$<[Condition1] = {'abc'},[Condition2] = $1>} $2)

and pass a whitespase as a parameter

vMyVariable( ,Sales) or vMyVariable({'abc'},Sales)

View solution in original post

3 Replies
andrey_krylov
Specialist
Specialist

Try this expression for a variable

Sum({$<[Condition1] = {'abc'},[Condition2] = $1>} $2)

and pass a whitespase as a parameter

vMyVariable( ,Sales) or vMyVariable({'abc'},Sales)

sunny_talwar

May be try this

=Sum({$<[Condition1] = {'abc'},[Condition2] = $1>}$2)


and then pass value like this for ignoring condition2

vMyVariable({*},Sales)

for other conditions, may be this

vMyVariable({">10"},Sales)

Dano
Contributor II
Contributor II
Author

putting $1 without {} and calling vMyVariable( ,Sales) solved the issue.

Thanks