Dear Excel Gurus,
I am seeking help how to replicate Excel's formula SumProduct in Power Query.
In one table I have payroll data (1), i.e. list of employees with their wage components.
In second table (2) I have information, if the wage component belongs to specific summary or not. Here I am using 3 states: 0 = do not use, 1 = add to summary, -1 = substract from summary. Where in this example I am creating 3 sums: Gross Income, Gross Salary, Net Salary.
My final table (3) has all original data and added summaries.
Normally I have over 100 wage components and over 4500 employees, so my concern is speed of the query. I believe that the answer is behind one or two List functions, but after 4 hours I gave up for the moment and created a primitive solution: Unpivot wage components. Merge with table with rules. Multiply value from source with value from rules. Summarized per EID and merge with original source. I know that something more elegant has to exist, but I only started learning Power Query 2 weeks ago, so the solution eludes me.
If someone can give me at least a hint which way to go, it would be great. If someone would be willing to create a solution, I am more than happy to buy them a couple of coffees via PayPal.
Thanks in advance to anyone willing to help.
I am seeking help how to replicate Excel's formula SumProduct in Power Query.
In one table I have payroll data (1), i.e. list of employees with their wage components.
In second table (2) I have information, if the wage component belongs to specific summary or not. Here I am using 3 states: 0 = do not use, 1 = add to summary, -1 = substract from summary. Where in this example I am creating 3 sums: Gross Income, Gross Salary, Net Salary.
My final table (3) has all original data and added summaries.
Normally I have over 100 wage components and over 4500 employees, so my concern is speed of the query. I believe that the answer is behind one or two List functions, but after 4 hours I gave up for the moment and created a primitive solution: Unpivot wage components. Merge with table with rules. Multiply value from source with value from rules. Summarized per EID and merge with original source. I know that something more elegant has to exist, but I only started learning Power Query 2 weeks ago, so the solution eludes me.
If someone can give me at least a hint which way to go, it would be great. If someone would be willing to create a solution, I am more than happy to buy them a couple of coffees via PayPal.
Thanks in advance to anyone willing to help.