Calculated Measure removing nulls from concatenate formula

Hello,

I'm using calculated measures to concatenate three fields:

 

Concatenate("NameFirst", ' ', "NameMiddle", ' ', "NameLast")

Some of the values are null.  So for example I'm getting Null Null Whitlow.  I would rather just see Whitlow and if there is a null value it should be blank.

Anyone able to help me modify my existing formula or come up with a new one to get the desired results?

Thanks!

 

tanya.whitlow's picture
Joined: Jul 12 2018 - 1:16pm
Last seen: 3 years 5 months ago

1 Answer:

A possible solution is to create a variable that check if field is null first.

For example:
Variable1
Name: Var_FirstName
Expression: $F{NameFirst} == null? "" : $F{NameFirst}
Variable2
Name: Var_LastName
Expression: $F{LastName} == null? "" : $F{LastName}

And then in the field use the function with both variables:
CONCATENATE($V{Var_FirstName}, " ", $V{Var_LastName} )

Probably there are better solutions this is just what came up to my mind.

Regards,

GL

GonzaLinares's picture
Joined: Apr 17 2018 - 10:50am
Last seen: 11 months 6 days ago
Feedback
randomness