Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Conditional accumulative in Power Query

Hello, please help )

 

I need to change value (text type) from mapping table. But it is important to keep the filter  (not to use Merge table 😞 )

 

what I have

Table1

Table 2

 

I applied the solution:

 

= List.Accumulate(
{0..List.Count(Table2[number])-1},
#"previous step",
(state, current) => Table.ReplaceValue (state,Table2[number]{current},

Table2[decode]{current}, Replacer.ReplaceText,{"Zones"}
) )

and i have this    : -(

 

 

but i need to use filter according to crf_form_id 

 

thanks in advance 

 

  • AlienSx's avatar
    AlienSx
    2 years ago

    not very performant but one step

        replace = Table.ReplaceValue(
            Table1, 
            (o) => o[crf_form_id],
            (n) => n[Zones],
            (v, o, n) => 
                try Table2{[crf_form_id = o, number = n]}[decode]
                otherwise null,
            {"Zones"}
        )

7 Replies