Forum Discussion

ChristianDGreat's avatar
ChristianDGreat
Resolver I
3 years ago
Solved

Sum if status is Invoiced

Hello,

 

I got stuck into these and probably need help.

So I have this table

 

Order IDStatusQty
1Open1
1Open2
1Open2
1Open3
1Open2
1Closed3
1Closed5
1Closed4
2Open1
2Open2
2Open1
2Open1
2Closed1
2Invoiced1

 

The result im looking for is this

Order IDQty
122

 

The logic here is if in the status there's a "Invoiced" it will ignore the order ID of it.

So in this case Order ID "2" has a "Invoiced" Status that means it ignores it in the result.

Order ID "1" doesnt have invoiced so it aggregate the qty. (sum)

1 Reply