Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tmacfrank
Frequent Visitor

Replace mutilple values in a column

Hi,

 

I want all that contian "Deposit" in column [type] become "Deposit" in a new column. Others remain the same.

Any hint for DAX ? 

 

type                             new type

 

Deposits-blend           Deposit

bills                             bills

withdraws                   withdraws

mail Deposits             Deposit

 

 

Thanks a lot !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@tmacfrank try using the search function

 

newtype = IF(SEARCH("Deposit",table1[type],1,0),"Deposit",table1[type])

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

@tmacfrank try using the search function

 

newtype = IF(SEARCH("Deposit",table1[type],1,0),"Deposit",table1[type])

Works perfectly, Thanks a lot.

 

However, I cannot search two or more values at one time, don't I.

for example 

newtype = IF(SEARCH("Deposit" or "Dep",table1[type],1,0),"Deposit",table1[type]), do i need one more if for searching "Dep". Thanks

Anonymous
Not applicable

@tmacfrank umm try like a normal or

 

IF(OR(SEARCH("Deposit",col1,1,0),SEARCH("Dep",col1,1,0),"Depost", col1)

it say too many arguments were passed to the OR function.

Anonymous
Not applicable

@tmacfrank i just realized or in power bi only takes 2 values, here are your options..

 

1) do or like this, where you sepearate all conditions by a pipe

 X = 1 || 2 || 3 || 5

 

2) use a switch

switch(true(),

SEARCH("Deposit",col1,1,0),"Deposit"

SEARCH("Dep",col1,1,0),"Deposit",

SEARCH("Depo",col1,1,0),"Deposit",

col1)

Thanks a lot!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.