IBM Apptio

IBM Apptio

A place for Apptio product users to learn, connect, share and grow together.

 View Only
Expand all | Collapse all

Replace NULL values with 0 for numeric fields

  • 1.  Replace NULL values with 0 for numeric fields

    Posted Thu June 09, 2016 12:25 PM

    Is there a formula or trick in Apptio that replaces NULL values in a raw data set with a zero, for numeric columns?

     

    The logic for several formulas in our model check whether a value is "0" is not. NULL values are being evaluated as non-zero values and this is causing unexpected results with the formulas.

     

    With the number of data sets uploaded into our model each month, we would like to avoid the validation steps required to  ensure each numeric value does not contain NULL values.







    #CostingStandard(CT-Foundation)


  • 2.  Re: Replace NULL values with 0 for numeric fields

    Posted Thu June 09, 2016 12:39 PM

    Test and see if "=NumberFormat(ColumnName,"0000000")" would work.  Maybe alter to show as =NumberFormat(ColumnName,"0,000.00") if dealing with dollars. 


    #CostingStandard(CT-Foundation)


  • 3.  Re: Replace NULL values with 0 for numeric fields

    Posted Thu June 09, 2016 12:45 PM

    Simple, yet extremely effective! Thanks!

     

    We're are starting to discuss processes and governance around our TBM discipline and we're trying to eliminate as many touch points (to people or data) as possible. This helps a lot.

     

    Thanks again


    #CostingStandard(CT-Foundation)


  • 4.  Re: Replace NULL values with 0 for numeric fields

    Posted Thu June 09, 2016 12:51 PM

    Happy to help and glad it worked out!  We have had some issues with project numbers coming in without leading zeroes and that has helped us, too.    Building in logic to catch those 'gotchas' is always easier than crawling through the data every month for sure!


    #CostingStandard(CT-Foundation)


  • 5.  Re: Replace NULL values with 0 for numeric fields

    Posted Tue June 21, 2016 05:33 AM

    If you want to alter the original column so that nulls are replaced with zeros, and all other values are left alone, you can override with the following formula.

     

    =If($_=null,0,$_)


    #CostingStandard(CT-Foundation)


  • 6.  Re: Replace NULL values with 0 for numeric fields

    Posted Fri March 09, 2018 01:35 PM

    Getting an error....

     

    "Cannot find column named "null"" lol


    #CostingStandard(CT-Foundation)


  • 7.  Re: Replace NULL values with 0 for numeric fields

    Posted Fri March 09, 2018 04:05 PM

    Try

     

    =if($_="",0,$_)


    #CostingStandard(CT-Foundation)


  • 8.  Re: Replace NULL values with 0 for numeric fields

    Posted Fri March 09, 2018 06:29 PM

    That works, but is that truly NULL? What about numeric values?


    #CostingStandard(CT-Foundation)


  • 9.  Re: Replace NULL values with 0 for numeric fields

    Posted Mon March 12, 2018 03:37 PM

    Not sure I'm following your question?


    #CostingStandard(CT-Foundation)


  • 10.  Re: Replace NULL values with 0 for numeric fields

    Posted Mon March 12, 2018 03:56 PM

    NULL is NULL no matter what the datatype. Most programming languages have a constant or keyword for NULL, because "" is an empty string type, not exactly NULL. 

     

    My question is, would "" also match NULL for numeric values (not string or text)?

     

    Seems to work for me, but I'm not positive I'm actually checking for NULL. 


    #CostingStandard(CT-Foundation)


  • 11.  Re: Replace NULL values with 0 for numeric fields

    Posted Mon March 12, 2018 04:00 PM

    Should work for both text and numeric!


    #CostingStandard(CT-Foundation)


  • 12.  Re: Replace NULL values with 0 for numeric fields

    Posted Mon March 12, 2018 04:05 PM

    NULL in this case is BLANK really - so if you're looking for zero as well, would add that to your logic.  So what Justin had earlier of =if($_="" OR $_=0,0,$_) but add the extra orange text to it.  There are some that may appear as '0', but are actually just >0 and <1..


    #CostingStandard(CT-Foundation)


  • 13.  Re: Replace NULL values with 0 for numeric fields

    Posted Wed March 21, 2018 11:28 PM