Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
pratichi
Frequent Visitor

Need to Match Quantities (Supplied vs Ordered)

I have a Table 

Shipment NoShipment
Line no
Order  NumberOrder
Line no
Item NameSupplied QuantityOrdered Quantity
S11

O1

1Item A510
S12O12Item B1010
S21O11Item A510
S31O21Item C1010

 

I want to check for every line in an order, the total shipped quantity is equal to the Order Quantity.

So for O1, Line 1, 10 units are order and if all 10 units have been supplied irrelevant of the no. of shipments.

 

As you can see item A in Order O1 has been shipped in 2 different shipments.

Since the order quantity is always going to show 10 for a particular order, irrespective to the supplied quantity, I am unable to figure out how can I match the supplied vs ordered quantity at the Order level.

 

I was thinking Concatenate Order-Item Name-Order line No. Then check Sum of Supplied quantity vs First/last of Ordered quantity but not sure how the formula would be.

 

I'm still a rookie in power BI and from a non-IT background, so any assistance on this would be very helpful.

Thanks in advance.

I see @Greg_Deckler @amitchandak  are amongst the best and kind on this forum, can you please guide me in the right direction.

6 REPLIES 6
Anonymous
Not applicable

 

// Returns True if item
// has been fully shipped.
// False if not. I assume
// that it's not possible
// to ship more than Ordered
// Quantity
[Shipped All] =  // calculated column, not a measure
var __orderNo = T[Order Number]
var __itemName = T[Item Name]
VAR __totalSupplied =
    SUMX(
        FILTER(
            T,
            T[Order Number] = __orderNo
            &&
            T[Item Name] = __itemName
        ),
        T[Supplied Quantity]
    )
RETURN
  ( T[Ordered Quantity] = __totalSupplied )

 

amitchandak
Super User
Super User

@pratichi , see it this measure work for remaining qty

 

sumx(Summarize(Table, table[Order Number],Table[Order Line no], Table[Item Name], "_1", sum(Table[Supplied Quantity]), "_2",max(Table[Ordered Quantity])),[_2]-[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@pratichi - You could create a calculated column like the following:

 

In Full = 
  VAR __SuppliedQuantity = SUMX(FILTER('Table',[Order Number] = EARLIER('Table'[Order Number]) && [Order Line] = EARLIER('Table'[Order Line]),[Supplied Quantity])
RETURN
  IF([Ordered Quantity] = __SuppliedQuantity,1,0)

 

Ones have been supplied in full, zeros have not.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,

When I apply this calculated column I get an error:

<pi>A circular dependency was detected: Table_Order[Pending Order].</pi>

What am I missing?

Thanks,

Fernando

calerof
Impactful Individual
Impactful Individual

I've got it. I was using an explicit measure for quantity. When changed for the Quantity column it works magic.

Thanks,

F

It reads The syntax for 'Return' is incorrect.

DAX(VAR __SuppliedQuantity = SUMX(FILTER('Table',[Order Number] = EARLIER('Table'[Order Number]) && [Order Line] = EARLIER('Table'[Order Line]),[Supplied Quantity])
RETURN
IF([Ordered Quantity] = __SuppliedQuantity,1,0)

 

It start marking a mistake right after Sumx. I believe thats because Sumx(table,expression) ?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.