Forum Discussion

mithiladas02's avatar
mithiladas02
Helper I
4 years ago
Solved

Replace value

I have table like below

when i try to replace value  From Source field- Linkdln, it is changing social media- Linkdln also. How can i change only jobboards-linkdln name? 

Source CategorySource
Social MediaLinkdln
JOb Boardsjob street
JOb boardsLinkdln

 

 

How can i show below table in power query?

 

Source CategorySource
Job BoardsJob Boards-Linkdln
Social MediaLinkdln
Job BoardsJob Street
  • mithiladas02 , A new column in power query

    if [Source Category] = "Job Boards" and [Source]="Linkdln" then [Source Category] & "-" & [Source] else [Source Category]

  • Hi mithiladas02 ,

     

    Try something as follows in Power Query editor in Power BI.

     

    This is the data:

     

    Now under Add Column:

     Then a new window appears:

     

    Formula that I have written can be seen below in editor window:

    if 
       ([Source Category] = "JOb boards" 
       and [Source] = "Linkdln") 
       then "Job Boards-Linkdln" 
       else [Source]

    You will get following:

    Just remove the Source column:

    Modify data-type of New Source to text and rename it to Source. You will get required results:

     

    Thanks,

    Pragati

     

2 Replies

  • mithiladas02 , A new column in power query

    if [Source Category] = "Job Boards" and [Source]="Linkdln" then [Source Category] & "-" & [Source] else [Source Category]

  • Hi mithiladas02 ,

     

    Try something as follows in Power Query editor in Power BI.

     

    This is the data:

     

    Now under Add Column:

     Then a new window appears:

     

    Formula that I have written can be seen below in editor window:

    if 
       ([Source Category] = "JOb boards" 
       and [Source] = "Linkdln") 
       then "Job Boards-Linkdln" 
       else [Source]

    You will get following:

    Just remove the Source column:

    Modify data-type of New Source to text and rename it to Source. You will get required results:

     

    Thanks,

    Pragati