Replicating a SUMPRODUCT formula using a Query Expression

mcmuney

Board Regular
Joined
Sep 11, 2015
Messages
101
Office Version
  1. 365
Hi, I have an Excel formula that I'm trying to replicate in a query expression. Can anyone help?

Excel Formula
Code:
=IF(SUMPRODUCT(($D$2:$D$12000)*($J$2:$J$12000=J1747))<-999999,"Yes","No")

For the Expression:

ColumnD = B.MONETARY_AMOUNT
ColumnJ = B.ACTIVITY_ID

Basically, my query results will have the ACTIVITY_ID repeat with different AMOUNTS and I need a SUM in a different column. I'm currently doing this in Excel with the Query results, but I'm trying embed this into the query, saving me calc time in Excel.

Is this possible to do?

Thanks.
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
is that what you want?

Code:
Condition = Table.AddColumn(Table.Group(Source, {"B.Activity_ID"}, {{"Sum.Amount", each List.Sum([B.Monetary_Amount]), type number}}), "IF", each if [Sum.Amount] < -999999 then "Yes" else "No")

I assumed you're talking about PowerQuery (Get&Transform)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top