Calculated Field Enquiry

Hi Guys,

Seeking help from the experts in this forum for some ideas on how to achieve my requirement below:

I have a calculated field with formula as follow:

POHeader.TotalOrder - SubQuery5.Calculated_PostedAmt

By normal means, it will display a value. However under some scenarios where the posted amount is NULL/ not available, it wouldn’t display a value there.

Is there any way to convert the NULL/Blank value to 0 in order for me to display the POHeader.TotalOrder amount instead of blank value?

Thanks and Regards,
CK

I’m no expert, but I can think of two ways to do this

In your SubQuery5.Calculated_PostedAmt you can do a case statement
CASE WHEN (calculation IS NULL) THEN 0 ELSE (calculation) END
or
In the calculation you listen above, also a case statement
CASE WHEN (SubQuery5.Calculated_PostedAmt IS NULL) THEN (POHeader.TotalOrder) ELSE (POHeader.TotalOrder - SubQuery5.Calculated_PostedAmt) END

2 Likes

Thank you very much! exactly what I’m looking for! :slight_smile:

I’m late to the party, but the shorthand goes something like this:

POHeader.TotalOrder - isnull(SubQuery5.Calculated_PostedAmt, 0)

If the field has a null value, we insert a value of zero.

Joe

1 Like

better late than never haha, thanks a lot !