I briefly looked at your BAQ and suspect that you have mutliple Releases per your sales order lines?
To prove this, add the OrderRel table to your top level query and display the release numbers along with the warehouse.
And/or - PART PLANT subquery looks like the root of your problem - you could try adding the Sales Order LINE to that too?
Row multiplication resulting from mixing ādimensionsā is something I see users doing all the time in Epicor. I usually start out I display header, line and releases in the raw data, then decide how to aggregate from there.
A query that has any rows as Group By must have all non-aggregated rows as GROUP BY. Aggregated rows would be ones with functions like SUM() or COUNT() in them. Iāll see if I can whip up an example.
What happens if you just wrap your two fields in a sum and group the other fields? You have to remove the warehouse code for grouping but you have that displayed in your column.
i.e. parts may be in many bins.
Rather than digging into the specific query, here is a marked up schema screen shot - where I try to display some causes for row multiplication - and pseudo subquery for Part Bin Qtys.
Also, do you have you have access to EpicWeb/EpicCare sites?
And have already downloaded the Epicor ICE - āTools User Guideā and āCustomization User Guideā.
Can be kind of a pain to go thru and read butā¦ they do include some good BAQ examples, will show some grouping and aggregate calculations.
One Calc field for each warehouse, with the formulas:
SUM(case when PartBin.WarehouseCode = 'mfg' THEN PartBin.OnhandQty ELSE 0 end)
and
SUM(case when PartBin.WarehouseCode = 'CHAL2' THEN PartBin.OnhandQty ELSE 0 end)
The difference being which warehouse (mfg or CHAL2).
Then used that in place of the PartBin table in the top query:
with display fields:
The last two ācalc fieldsā are actually just āfieldsā from the subquery2. No calculation exists in Subquery1 (the top level query) for those two. The two Calc above it do use fields from JobMtl and Subquery2.
edit
This combines all the part bins for all warehouses into a single record, with individual columns for the warehouse QOH
In post 15, I was mistaken about only having one warehouse - Our production DB has just one per site, but our Test environment has multiple per site. Each row in the screenshot in post 15 was from a different warehouse. The warehouse names werenāt shown.
If i filtered my original BAQ (the one used for post 15) to just be warehouses mfg and CHAL2, then there would have only been 2 of the 6 rows shown.
Post 15 was mostly to show why one would get multiple rows.
After learning that the columns in the Original Posterās screen shot were for specifc warehouses, I made the sub query so that it returned one row per partnum.