Forum Discussion

android11's avatar
android11
Regular Visitor
10 years ago
Solved

Creating a new column if values in column 1 = column 2

Hi,

 

I am trying to create a new column that includes all names in column Fullname if they are equal 

to a certain value in column UserType.

 

If Mary Byrne in Fullname is of UserType "Caregiver", I want Mary added to a new column Caregiver.

Tried this with no luck -> Carergiver = IF( Users[FullName],[UserType]="Caregiver")

 

  • if you are doing this in Power Query then
    this should do it
    =if [usertype]="caregiver" then [Fullname] else ""

    if you are creating a calculated column then its

    Caregiver = if(users[UserType]="caregiver",users[Fullname],BLANK())

    The first part of an IF is to check the logic so it checks to see if the first expression is true or false
    then the second part is what is returned if its TRUE
    and the last if it is false

10 Replies

  • if you are doing this in Power Query then
    this should do it
    =if [usertype]="caregiver" then [Fullname] else ""

    if you are creating a calculated column then its

    Caregiver = if(users[UserType]="caregiver",users[Fullname],BLANK())

    The first part of an IF is to check the logic so it checks to see if the first expression is true or false
    then the second part is what is returned if its TRUE
    and the last if it is false

    • android11's avatar
      android11
      Regular Visitor

      Perfect Neuro. Thank you very much. It was for a Calculated Column.

    • android11's avatar
      android11
      Regular Visitor

      If I use your Custom Column option and change caregiver to client & put these two columns in a table,

      one column is always blank. How do I get both to display side by side?

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

        if you have only two usertypes then yes one would always be blank
        as you are checking in one column if one is a caregiver and in the other if it is a client.

        In my mind I think what you are trying to do is show for any row who is the caregiver and who is the client.
        if that is the case you would need to create some sort of relationship between the caregiver and the client

        but please do correct me if I am mistaken and if you can provide your desired output (maybe display it in an excel screen shot)
        and I will try and help you when im back online tomorrow morning