Forum Discussion
How to apply Index/Match/If for array function in Power Query?
- Anonymous7 years ago
Hi,
Try this in your power query advanced editor:
let Origen = Excel.CurrentWorkbook(){[Name="tWorkbook"]}[Content], #"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"ITEM_NO", type text}, {"Com.group", Int64.Type}, {"Annual demand", Int64.Type}}), #"Consultas combinadas" = Table.NestedJoin(#"Tipo cambiado",{"Com.group"},tReference,{"Com.group"},"tReference",JoinKind.LeftOuter), #"Se expandió tReference" = Table.ExpandTableColumn(#"Consultas combinadas", "tReference", {"Qty interval"}, {"Qty interval"}), #"Columna condicional agregada" = Table.AddColumn(#"Se expandió tReference", "Personalizado", each if [Qty interval] <= [Annual demand] then 1 else 0), #"Filas filtradas" = Table.SelectRows(#"Columna condicional agregada", each ([Personalizado] = 1)), #"Columnas quitadas" = Table.RemoveColumns(#"Filas filtradas",{"Personalizado"}), #"Filas agrupadas" = Table.Group(#"Columnas quitadas", {"ITEM_NO", "Com.group", "Annual demand"}, {{"Qty Interval", each List.Max([Qty interval]), type number}}), #"Consultas combinadas1" = Table.NestedJoin(#"Filas agrupadas",{"Com.group", "Qty Interval"},tReference,{"Com.group", "Qty interval"},"tReference",JoinKind.LeftOuter), #"Se expandió tReference1" = Table.ExpandTableColumn(#"Consultas combinadas1", "tReference", {"Recommended Qty"}, {"Recommended Qty"}) in #"Se expandió tReference1"Tell us if works for you.
- Anonymous7 years ago
Hi L,
I can to replicate the issue. You must have one or more some cells empty that is interpreted by power query as "null".
You have to delete each of their rows or fill each of them with their right information in your source or add other step with what power query should do with those "null" values.
Kind regards.
Hi Ashish, thank you for your suggestion. Unfortunately, I can't get it working. When I copy your formula in the Custom column in Query for Table2 I get the wrong message. What am I doing wrong?
Hi,
You are writing my formula at the wrong place. Mine is a calculated formula solution - not an M solution.
- L70F7 years agoHelper II
Hi Ashish,
where can I found the right place to insert your culculation formula? I have done it by insert "Custom column" and then copy in it your formula. But it didn't work. I tried also with "Invoke custom function", but come nowhere with it. Pehaps you can show some screen shots so I can learn me.
Thanks a lot.
Best regards
Larissa
- Ashish_Mathur7 years agoSuper User
Hi,
You have to go to Modelling > New calculated column