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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
brinky
Helper IV
Helper IV

power query replace

Could some one assit what I'm doing wrong, I'm trying to combine "Route" with [Route_No] and is reaming blamk whereas when I add [Epiry_date] is works perfectly.

 

Thanks in advance

 

Screenshot PowerQuery.png

1 ACCEPTED SOLUTION

You're missing the parenthesis

 

Table.ReplaceValue(#"Filtered Rows", each [Route_Description], each if [Route_No] = 125 then "Route" & Text.From([Route_No]) else [Route_Description], Replacer.ReplaceValue,{"Route_Description"})

View solution in original post

5 REPLIES 5
ronrsnfld
Super User
Super User

I suggest a somewhat different approach, which also takes into account that the data type of Route_No, which is a string of digits, might be text or number (your column header shows it as type any.

 

If you will always be certain of the data type for Route_No, you can shorten the code a bit:

 

 

= Table.FromRecords(
            Table.TransformRows(Source,
             (r)=>
                Record.TransformFields(r, 
                    {"Route_Description", each 
                            if Text.From(r[Route_No]) = "125" then "Route" & Text.From(r[Route_No]) else r[Route_Description]})
                ))

 

 

m_dekorte
Resident Rockstar
Resident Rockstar

Hi @brinky 

 

[Route_No] appears to be a numeral try Text.From( [Route_No] ) in your replace by statement instead.

Still nothing

 

= Table.ReplaceValue(#"Filtered Rows", each [Route_Description], each if [Route_No] = 125 then "Route" & Text.From[Route_No] else [Route_Description], Replacer.ReplaceValue,{"Route_Description"})

You're missing the parenthesis

 

Table.ReplaceValue(#"Filtered Rows", each [Route_Description], each if [Route_No] = 125 then "Route" & Text.From([Route_No]) else [Route_Description], Replacer.ReplaceValue,{"Route_Description"})

Gosh, spot on @m_dekorte thanks for your help, much appricated.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.