Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Null Values

I want my expression to calculate the sum of 2012 'RevDollars' and include the following conditions:

  • StartDate = Prior to 2008 (oldest date in records is 1984)
  • Include Null and Not-Null Values for StartDate (oldest record is 1984, but lots of null values are present in data set)

This is what I have so far, but I don't know how to include the null values:

sum({$<Year={2012},StartDate={'=<2008'}>}RevDollars)

Can anyone help me fix the syntax?

7 Replies
chematos
Specialist II
Specialist II

Try this and let me know:

sum({$<Year={2012},StartDate={'<=$(=2008)'},StartDate={'=null()'}>}RevDollars)

try StartDate={'=null()'} or StartDate= {''}

hope this helps

Not applicable
Author

I couldn't get it to work. When I try the following two expressions, I only get the non-null values:

sum({$<Year={2012},StartDate={'<=$(=2008)'}>}RevDollars)+sum({$<Year={2012},StartDate={''}>}RevDollars)

sum({$<Year={2012},StartDate={'<=$(=2008)'}>}RevDollars)+sum({$<Year={2012},StartDate={'=null()'}>}RevDollars)

chematos
Specialist II
Specialist II

May be null values are discarded because of the filters or the model so it will never add values for null data.

Could you upload your qvw ??

Not applicable
Author

Here is an example. Thank you for your help on this!

Sokkorn
Master
Master

Hi,

Let try

=sum({$<Year={2012},StartDate={'<=$('2008')'}>} RevDollars) + sum({$-<StartDate=-{}>} RevDollars)

instead of

=sum({$<Year={2012},StartDate={'<=$('2008')'}>}RevDollars)+sum({$<Year={2012},StartDate={''}>}RevDollars)

Regards,

Sokkorn

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I think the correct syntax should be:

sum({$<Year={2012},StartDate={'<=2008', "=len(StartDate)=0"}>}RevDollars)

Not applicable
Author

I couldn't get those expressions to work (the nulls were still missing), so I ended up just adding a StartYearIndicator field in the script. I guess it's the long way around, but it worked. Thanks for your help everyone.