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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
WJ876400
Helper IV
Helper IV

Replace all in table not just a column

Hi,

 

I have a table of data from a survey and there are 6 questions that require a response of Strongly Agree, Agree, Neutral, Disagree and strongly agree. I want to add a number before each so I can sort the visuals. Is there a way to replace a value for all columns or will i have to do it individually for all columns.

 

So I want to replace all strongly agree with 1. Strongly Agree but dont want to have to do it by each column can I just do a replace all that finds strongly agree and then replace with 1. Strongly agree.

 

thanks in advance

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@WJ876400 , Try using below Power Query for this

 

let
    Source = YourDataSource,
    ReplaceValues = Table.TransformColumns(Source, List.Transform(Table.ColumnNames(Source), each {_, each Text.Replace(_, "Strongly Agree", "1. Strongly Agree"), type text})),
    ReplaceValues2 = Table.TransformColumns(ReplaceValues, List.Transform(Table.ColumnNames(ReplaceValues), each {_, each Text.Replace(_, "Agree", "2. Agree"), type text})),
    ReplaceValues3 = Table.TransformColumns(ReplaceValues2, List.Transform(Table.ColumnNames(ReplaceValues2), each {_, each Text.Replace(_, "Neutral", "3. Neutral"), type text})),
    ReplaceValues4 = Table.TransformColumns(ReplaceValues3, List.Transform(Table.ColumnNames(ReplaceValues3), each {_, each Text.Replace(_, "Disagree", "4. Disagree"), type text})),
    ReplaceValues5 = Table.TransformColumns(ReplaceValues4, List.Transform(Table.ColumnNames(ReplaceValues4), each {_, each Text.Replace(_, "Strongly Disagree", "5. Strongly Disagree"), type text}))
in
    ReplaceValues5
 
replace yourdatasource with actual source



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
WJ876400
Helper IV
Helper IV

Thank you very much

bhanu_gautam
Super User
Super User

@WJ876400 , Try using below Power Query for this

 

let
    Source = YourDataSource,
    ReplaceValues = Table.TransformColumns(Source, List.Transform(Table.ColumnNames(Source), each {_, each Text.Replace(_, "Strongly Agree", "1. Strongly Agree"), type text})),
    ReplaceValues2 = Table.TransformColumns(ReplaceValues, List.Transform(Table.ColumnNames(ReplaceValues), each {_, each Text.Replace(_, "Agree", "2. Agree"), type text})),
    ReplaceValues3 = Table.TransformColumns(ReplaceValues2, List.Transform(Table.ColumnNames(ReplaceValues2), each {_, each Text.Replace(_, "Neutral", "3. Neutral"), type text})),
    ReplaceValues4 = Table.TransformColumns(ReplaceValues3, List.Transform(Table.ColumnNames(ReplaceValues3), each {_, each Text.Replace(_, "Disagree", "4. Disagree"), type text})),
    ReplaceValues5 = Table.TransformColumns(ReplaceValues4, List.Transform(Table.ColumnNames(ReplaceValues4), each {_, each Text.Replace(_, "Strongly Disagree", "5. Strongly Disagree"), type text}))
in
    ReplaceValues5
 
replace yourdatasource with actual source



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.