Forum Discussion
GianJo
3 years agoNew Member
Replace Value with previous Row based on a condition
Hello everybody, I am trying to replace a value based on a condition. If the condition is true I want to replace the value with the one in the previous Row. I am using Table.replaceValue but I ma...
- 3 years ago
Hi GianJo ,
Almost there, "Replacer.ReplaceText" replace text selected whereas "Replacer.ReplaceValue" replace the value
Table.ReplaceValue( AggiuntaColonnaIndice, each [ClasseProva], each if [ClasseProva] = "ciao" then AggiuntaColonnaIndice{[Indice]}[ClasseProva] else [ClasseProva], Replacer.ReplaceValue,{"ClasseProva"})Now, if you create your Index from 0, you can do:
= Table.ReplaceValue( AggiuntaColonnaIndice, each [ClasseProva], each if [ClasseProva] = "ciao" then AggiuntaColonnaIndice{[Indice]-1}[ClasseProva] else [ClasseProva], Replacer.ReplaceValue,{"ClasseProva"})and its clearer in my mind you are getting previous row.
GianJo
3 years agoNew Member
Thank you very much!! It works perfectly!