Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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"})
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.
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.
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?
Yep. See for example my answer here:
Looks good i will give it a go later on and let you know how it goes.