Forum Discussion

alittle1's avatar
alittle1
Frequent Visitor
5 years ago
Solved

new column based on specific text within a column

I am trying create a new column in a table based on [fpartno] where:   - if the 14th digit of the [fpartno] is F, the value in the new column should show "RC_FP" - if the 14th digit of the [fpartn...
  • AlB's avatar
    5 years ago

    alittle1 

    Ah, of course. I did not realize at first sight. What you are doing is looking for the position of the first R or first F. And that can be before the position 14 (even if there's an "R" at position 14) What you actually need is to extract the character in position 14 and then check if it is an R or an F:

     

    cRCtest V2 =
    SWITCH (
        RIGHT ( LEFT ( dbMfgUnits[fpartno], 14 ), 1 ),
        "R", "RC_FP",
        "F", "RC_RP"
    )
    

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers