i need to replace some values in a column

LINUS_MAASTOK

New Member
Joined
Oct 25, 2019
Messages
11
Hello, first that all excuse me for my bad english ;( I need your help, im new with power BI

I have a table named LECTURA that contains a column named SMS. The column SMS have a lot of values, and i need to change the value of a part of it.

The values i need to change have the structure "Lecture order 123456789 discarted, order state 8" and only the number changes from row to row... I need to replace all of these values to "Discarted"

Code:
[COLOR=#333333][FONT='inherit']SMS
[/FONT][/COLOR][COLOR=#333333]"[/COLOR][COLOR=#333333][FONT=Verdana]234524354[/FONT][/COLOR][COLOR=#333333]"                                                                                "[/COLOR][COLOR=#333333][FONT=Verdana]Non Discarted[/FONT][/COLOR][COLOR=#333333]"[/COLOR]
[COLOR=#333333][FONT='inherit']"[FONT=Verdana]Lecture order 123456789 discarted, order state 8[/FONT]"        TO             "[FONT=Verdana]Discarted[/FONT]"[/FONT][/COLOR]
[COLOR=#333333][FONT='inherit']"[FONT=Verdana]Lecture order 836456789 discarted, order state 8[/FONT]"       --->            "[FONT=Verdana]Discarted[/FONT]"[/FONT][/COLOR]
[COLOR=#333333][FONT='inherit']"[FONT=Verdana]Lecture order 543453459 discarted, order state 8[/FONT]"                         "[FONT=Verdana]Discarted[/FONT]"
[/FONT][/COLOR][COLOR=#333333]"[/COLOR][COLOR=#333333][FONT=Verdana]98203498234[/FONT][/COLOR][COLOR=#333333]"                                                                            "[/COLOR][COLOR=#333333][FONT=Verdana]Non Discarted[/FONT][/COLOR][COLOR=#333333]"[/COLOR]

I try with this .... but i failed

Code:
[COLOR=#000000][FONT=Consolas]Columna = LECTURA_APORTADA.ReplaceValue([TXT_SMS];
        each
            if (Text.StartsWith([TXT_SMS];"Orden de lectura "))
        [/FONT][/COLOR][COLOR=#000000][FONT=Consolas]       if (Text.StartsWith([TXT_SMS];"Orden de lectura "))
               and (Text.EndsWith([TXT_SMS];" descartada, estado de la orden 8"))
            then "Descartada"
            else [TXT_SMS];
        Replacer.ReplaceValue; {"TXT_SMS"}
    )
[/FONT][/COLOR]

some ideas? ;( and (Text.EndsWith([TXT_SMS];" descartada, estado de la orden 8"))
then "Descartada"
else [TXT_SMS];
Replacer.ReplaceValue; {"TXT_SMS"}
)

[/CODE]

some ideas? ;(
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Use this formula. You may need to adjust/change 15 in the MID function.

Code:
=IF(ISERR(SEARCH("discarted",A1)<>0),A1,MID(A1,15,9))
 
Upvote 0
via PQ with M-code

Code:
[SIZE=1]    IF = Table.AddColumn(Type, "Custom", each if Text.Contains([SMS], "Lecture") then "Discarted" else "Non Discarted")[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,967
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top