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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
moomarine
Helper II
Helper II

Replace all value in multiple columns that are greater than 0 with text value

Hi All

 

How do i amend the below to change all values greater than zero to "Completed" and any that are zero to "Not Completed" in multiple columns? The data is basically multiple course completions count per resource.

 

At the moment i have the below formula to find "Completed" and a separate formula string/step to find the zeros which = "Not Completed" but i am finding a lot of rows have 2 or 3 etc (multiple completions of the same course)

 

= Table.ReplaceValue(#"Changed Type",0,"Not Completed",Replacer.ReplaceValue,{"Course 1", "Course 2", "Course 3", "Course 4", "Course 5"})

 

= Table.ReplaceValue(#"Replaced Value2",1,"Completed",Replacer.ReplaceValue,{"Course 1", "Course 2", "Course 3", "Course 4", "Course 5"})

5 REPLIES 5
V-pazhen-msft
Community Support
Community Support

@moomarine 

 

For a workaround, you can only replace 0 with "Not Complete": hold on shift selected the most left and the most right column to select all columns,  change the data type to text, then use replace function as below, that only replaces 0 with Not complete.

V-pazhen-msft_1-1618472552809.png

 

In addition, you may follow the below link that creates a column name list then replace value for the whole table.

Power Query - Replace values for whole table - Hat Full of Data

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

 

 

 

AlexisOlson
Super User
Super User

Table.TransformColumns works better here.

 

= Table.TransformColumns(#"Changed Type",
{
    {"Course 1", each if _ > 0 then "Completed" else "Not Completed", type text},
    {"Course 2", each if _ > 0 then "Completed" else "Not Completed", type text},
    {"Course 3", each if _ > 0 then "Completed" else "Not Completed", type text},
    {"Course 4", each if _ > 0 then "Completed" else "Not Completed", type text},
    {"Course 5", each if _ > 0 then "Completed" else "Not Completed", type text}
})

 

 

 

Hi, thanks for your response, only issue with this there are over 100 different courses so would be hard going typing this out. Is there any other way?

Looks good i will give it a go later on and let you know how it goes.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors