cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KaterineCAA Frequent Visitor
Frequent Visitor

Add suffix from existing column to another existing column in Query Editor

Hi!

 

I'm looking to add a suffix from an existing column to another existing column in the Query Editor. I've tried the following formula, but it doesn't work :

 

 

= Table.TransformColumns(#"Personnalisée ajoutée", {{"idResponse", each _ & " -" & Text.From([Année Baromètre], "fr-CA"), type text}})

 

 

I would like to limit my steps and do so without creating another column. Is it possible?

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-yulgu-msft
Microsoft

Re: Add suffix from existing column to another existing column in Query Editor

Hi @KaterineCAA,

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc07DoAgFETRrZhXU8DDD5a6BFtCYSKFhWDQRek62JjGRqY8meSOtbQukz/2GA5PgoYQ8u2rcU5xy9eZPDlhqXsXlsp8MCX6EkqCFIhBGgR9BU2GJkOTocnQ5BrUgFoQvOv/zz0=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"idResponse", Int64.Type}, {"Année Baromètre", Int64.Type}}),
    #"Replace_Value" =Table.ReplaceValue( #"Changed Type1", each  [idResponse] ,each Text.Combine({Number.ToText([idResponse]), Number.ToText([Année Baromètre])}," - ") ,Replacer.ReplaceValue,{"idResponse"})
in
    Replace_Value

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
rajendran Super Contributor
Super Contributor

Re: Add suffix from existing column to another existing column in Query Editor

Can you post some sample data and the expected result?

 

Thanks
Raj

KaterineCAA Frequent Visitor
Frequent Visitor

Re: Add suffix from existing column to another existing column in Query Editor

Here's a sample of my data

 

idResponseAnnée Baromètre
72018
82018
92018
102018
112018
122018
132018
172018
192018
202018
212018
222018
232018
242018
252018
262018
272018
302018

 

Expected result would be :

idResponse
7 - 2018
8 - 2018
9 - 2018
10 - 2018
11 - 2018
12 - 2018
13 - 2018
17 - 2018
19 - 2018
20 - 2018
21 - 2018
22 - 2018
23 - 2018
24 - 2018
25 - 2018
26 - 2018
27 - 2018
30 - 2018
rajendran Super Contributor
Super Contributor

Re: Add suffix from existing column to another existing column in Query Editor

here you go:

let

...

,...

... // your earlier steps

  #"Replace_Value" =Table.ReplaceValue( #"Sample_Table", each  [idResponse],each [idResponse]&"-"&[Année Baromètre],Replacer.ReplaceValue,{"idResponse"})

 

//#"Sample_Table -- This is your earlier step

 

in

 

#"Replace_Value"

 

Here you are not creating new column.

 

Thanks

Raj

rajendran Super Contributor
Super Contributor

Re: Add suffix from existing column to another existing column in Query Editor

Hi @KaterineCAA

 

Does the above solution solve your issue?

 

Thanks

Raj

Microsoft v-yulgu-msft
Microsoft

Re: Add suffix from existing column to another existing column in Query Editor

Hi @KaterineCAA,

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc07DoAgFETRrZhXU8DDD5a6BFtCYSKFhWDQRek62JjGRqY8meSOtbQukz/2GA5PgoYQ8u2rcU5xy9eZPDlhqXsXlsp8MCX6EkqCFIhBGgR9BU2GJkOTocnQ5BrUgFoQvOv/zz0=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"idResponse", Int64.Type}, {"Année Baromètre", Int64.Type}}),
    #"Replace_Value" =Table.ReplaceValue( #"Changed Type1", each  [idResponse] ,each Text.Combine({Number.ToText([idResponse]), Number.ToText([Année Baromètre])}," - ") ,Replacer.ReplaceValue,{"idResponse"})
in
    Replace_Value

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors