Power Query SUMIFS Equivalent

Skip2MiLu

New Member
Joined
Aug 11, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I am looking for a power query custom column formula that will do the equivalent to this Excel SUMIFS formula below
Excel Formula:
=SUMIFS(Country_Variety_Sales[2023 TOTAL],Country_Variety_Sales[Secondary No],Country_Variety_Sales[@[Secondary No]],Country_Variety_Sales[Country],Country_Variety_Sales[@Country])

1696691141128.png


1696690839769.png
 

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.
Cannot manipulate data in a picture. Please upload your sample data using XL2BB so that we can test our potential solution without having to retype your whole data source. It is looking like a Group By will be what you need.
 
Upvote 0
Cannot manipulate data in a picture. Please upload your sample data using XL2BB so that we can test our potential solution without having to retype your whole data source. It is looking like a Group By will be what you need.
Unfortunately, I am not able to install XL2BB on my work computer. I get a "This file type is not supported in Protected View".

Also, I am looking for a power query formula and not and not an excel formula, so I am not sure how much help XL2BB is going to be.

Basically, I looking for a custom column formula within power query that will return the same result as using Excel SUMIFS formula. I also do not want to use power query grouping function to aggregate in this example

Here are my variables using Excel SUMIFS syntax as a reference that I am hoping will help direct you in coming up with the equivalent power query custom column formula. Keep in mind that the table and column names below are the same within power query, I am just not sure of power query syntax in relevant functions I must use:

SUMIFS
Sum_range:
Country_Variety_Sales[2023 TOTAL]
Criteria_range 1: Country_Variety_Sales[Secondary No]
Criteria1: Country_Variety_Sales[@[Secondary No]]
Criteria_range 2: Country_Variety_Sales[Country]
Criteria2: Country_Variety_Sales[Country]

1696768594268.png
 
Upvote 0
Ok. Thanks for the criteria.

Power Query:
= Table.Group(Prior Query Step {"Secondary No", "Country"}, {{"Totals", each List.Sum([2023 TOTAL]), type number}})

this should help to understand this
 
Upvote 0
Ok. Thanks for the criteria.

Power Query:
= Table.Group(Prior Query Step {"Secondary No", "Country"}, {{"Totals", each List.Sum([2023 TOTAL]), type number}})

this should help to understand this

Hi Alansidman

Excuse my inexperience with Power Query code, but is the formula you provided something that I can paste into a custom column section as per below 1st picture? As this is what I am looking for.

The second picture might help give an overview of what I trying to recreate as a custom column in Power Query instead of doing this in Excel.

1697182237242.png


1697183550410.png
 
Upvote 0
Looks like the error message says you are missing a closed curly bracket.
 
Upvote 0
Looks like the error message says you are missing a closed curly bracket.
Hi Alansidman

Sorry to be a bother, but I adjusted the formula with relevant colum data and expended the column, but it not doing the same as SUMIFS in the example I sent above.
Also previously loading this Country Variety Sales query resulted in about 4000 records, however it wanted to load 30 000+ records after I expanded the column from this SUMIFS calculated column.
So somewhere something is not working they way I wanted.

I not sure if you have any other ideas. Otherwise I will just need to do it the long way.

1697470678078.png
 
Upvote 0

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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