Forum Discussion
Query editor replace values less than threshold
- 9 years ago
Hi jomikk,
If you want to add a new column, you could try to add a "Conditional Column".
if [Column1] < 1 or [Column1] = null or Number.IsNaN([Column1]) then 9999 else [Column1]
I am still trying to find out a way to replace the value directly.
Best Regards!
Dale
- 9 years ago
Hi jomikk,
If you don't have any "NaN" value, you can try this to replace the values directly.
1. Right click "Column1", select "Replace Values";
2. Input any numbers, we only need this step to generate code for us;
3. Open "Advanced Editor", replace the code in red square with the code below.
each [Column1], each if [Column1] > -1 and [Column1] < 1 or [Column1] = null or Number.IsNaN([Column1]) then 9999 else [Column1],
4. Done, no new column needed.
I wonder if someone can help with the value "NaN".
Best Regards!
Dale
Hi jomikk,
If you don't have any "NaN" value, you can try this to replace the values directly.
1. Right click "Column1", select "Replace Values";
2. Input any numbers, we only need this step to generate code for us;
3. Open "Advanced Editor", replace the code in red square with the code below.
each [Column1], each if [Column1] > -1 and [Column1] < 1 or [Column1] = null or Number.IsNaN([Column1]) then 9999 else [Column1],
4. Done, no new column needed.
I wonder if someone can help with the value "NaN".
Best Regards!
Dale
Perfect!
- Anonymous7 years agoNot applicable
I had a similar scenario whre I need to replace negative values in the column to "Blank". I followed your steps exactly, The code was syntactically correct but my data was not reflecting the change.It was still showing me the negative values:. The code is below:
#"Replaced Value2" = Table.ReplaceValue(#"Sorted Rows1",each {"Pumptime"},each if {"Pumptime"} < 0 then "" else {"Pumptime"},Replacer.ReplaceValue,{"Pumptime"})