Skip to main content

I have to get this formula within BO mimicked in Tableau. Can someone please help how to achieve this?

 

=If(IsNull([Ship Phone Number]);" ";"("+Left(LeftTrim([Ship Phone Number]);3)+") "+Left(Right([Ship Phone Number];7);3)+"-"+Right([Ship Phone Number];4)+If(IsNull([Phone Ext No]);" ";(" Ext."+FormatNumber([Phone Ext No];"###"))))

 

Below 2 are the fields in DB:

 

Extension field - Ship Extn nr

Phone Number

 

Desired Outcome:

 

(207) 791-6832 

 

(203) 574-3636 Ext.1335

 

I have 2077916832 as phone number in my DB.

 

Thanks,

Amritha.

4 answers
  1. Nov 13, 2023, 5:53 PM

    IF NOT ISNULL([Phone Number-]) THEN

      "("+STR(LEFT([Phone Number-],4))+")" +

      STR(MID([Phone Number-],5,3)) + "-" +

      STR(RIGHT([Phone Number-],4))

    ELSE

      ""

    END

    +

    IF NOT ISNULL([SHIP_EXTN_NR]) THEN

      " Ext." + STR([SHIP_EXTN_NR])

    ELSE

      ""

    END

0/9000