Sumifs and power query Sumifs

Martin sherk

Board Regular
Joined
Sep 11, 2022
Messages
94
Office Version
  1. 365
  2. 2016
I wonder why in the normal Sumifs formula it will ignore the zero at the beg. of an invoice no., while sumifs in power query using aggregate won't ignore it


For Ex.

Sumifs between bank Data and ERP Data will show the below invoice as matching although in the Bank data the invoice doesn't have zero in the beg. (14071) while in ERP data it starts with zero (014071) and sumifs formula matches them with no problems

Invoice No.EntityCustomerCurrencyAmountERP (Sumifs)
14071USA1AlmadaUSD
400​
-400​

Invoice No.EntityCustomerCurrencyAmountBank (Sumifs)
014071USA1AlmadaUSD
-400​
400​

while the same thing with power query will not recognize the below invoice because it starts with zero in the ERP invoice column (014071) while it doesn't start with zero in the Bank invoice column (14071).

Invoice no. BankEntity BankCustomer BankCurrency BankAmount BankSum of ERP.Amount
14071USA1AlmadaUSD
400​
-

Invoice no. ERPEntity ERPCustomer ERPCurrency ERPAmount ERPSum of ERP.Amount
014071USA1AlmadaUSD
-400​
-


why the Power query doesn't match invoices if there is a zero, like in Bank it's 14071, ERP 014071 while the Normal sumifs formula can recognize and match them with no problems even though one inv. starts with the zero and the other doesn't.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try wrapping both Invoice no. references in Power Query with the Number.From function. Example

Power Query:
Number.From([Invoice no. ERP])
 
Upvote 0
Try wrapping both Invoice no. references in Power Query with the Number.From function. Example

Power Query:
Number.From([Invoice no. ERP])
i did so, but now when merging as new, i face the below error message

1667746979899.png
 
Upvote 0
It may be that your invoice number are not as depicted in your original post. What do the two sets of invoice numbers actually look like?
 
Upvote 0
Hi Martin

Why would you need both solutions?

The dash makes the value a text value which can't be converted.

You could try avoiding the "countif-bug":
 
Upvote 0
It may be that your invoice number are not as depicted in your original post. What do the two sets of invoice numbers actually look like?
it's a huge list of invoices, but i was wondering about invoices that start with zero, after adding your solution it worked but faced another error which was Dataformat.error
 
Upvote 0
maybe try wrapping both Invoice no. references in Power Query with the Text.TrimStart function with "0" as second parameter. Example

Power Query:
Text.TrimStart([Invoice no. ERP], "0")
 
Upvote 0
Solution

Forum statistics

Threads
1,216,146
Messages
6,129,142
Members
449,488
Latest member
qh017

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