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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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