Replicating a SUMPRODUCT formula using a Query Expression

mcmuney

Board Regular
Joined
Sep 11, 2015
Messages
97
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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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