Forum Discussion

mmarchioni's avatar
mmarchioni
Icon for Helper I rankHelper I
5 years ago
Solved

Add Prefix to only rows in column with text

I have a column where I would like to add a prefix to only those rows that have text.

 

What I have:

24

Blank

10

12

Blank

 

What I get when I add the prefix:

A24

A

A10

A12

A

 

What I want:

A24

Blank

A10

A12

Blank

 

I would like to keep the blank rows blank.

Could you please provide some guidance?

  • Samarth_18's avatar
    Samarth_18
    5 years ago

    You have updated your comment 🙂

    Anyways you can try below approch:-

    A2with_prefix =
    IF (
        Trim(rvTX[Related Patient.A2Cd]) <> BLANK(),
        "A" & rvTX[Related Patient.A2Cd],
        BLANK()
    )

8 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    HI mmarchioni ,

    You can create column with below code:-

    with_prefix =
    IF ( NOT ( ISBLANK ( prefix[Column1] ) ), "A" & prefix[Column1], BLANK () )

     

    Thanks,

    Samarth

    • Samarth_18's avatar
      Samarth_18
      Icon for Community Champion rankCommunity Champion

      Could you please share what you have tried and what output you are getting? 

      • mmarchioni's avatar
        mmarchioni
        Icon for Helper I rankHelper I

        I created a column with

         

        A2with_prefix =
        IF ( NOT ( ISBLANK ( rvTX[Related Patient.A2Cd] ) ), "A" & rvTX[Related Patient.A2Cd], BLANK () )
         
        And still got A's in the rows that were blank. The columns are formatted as text and not numbers (I am not sure if that makes a difference).