Show Customer Orders that also had orders yesterday

281 Views Asked by At

I am trying to create a formula that will show all orders for customers that have an order yesterday.

So if the customer has an order yesterday, show all orders for that customer but if a customer has no order yesterday then show nothing. This is the formula that I have used but it isn't customers that only had orders yesterday:

sum({$<[Customer Adj]=p({<[Invoice Date Num]={$(=vxToday-1)}>}), [Originating cl for order]-={'B', 'E', 'P'}, BilltoShiptoSales_Flag={0} >} 
[Cases_Aggr])

I will then need to limit this by only show the previous week of their orders but I can figure that out.

Purpose of this: The reason for this is at my job some customers abuse Friday delivery's and as a result we have way too many Friday delivery's. We are trying to see all the customers who got Friday delivery's and then see if they get a large order earlier in the week that warrants their Friday delivery. If not, maybe we can get them to get their order earlier in the week.

picture of result: enter image description here

1

There are 1 best solutions below

6
On

another way of doing this:

  1. create a variable that stores all customers that have an order yesterday: vCustomers =concat({<[Invoice Date Num]={$(=vxToday-1)}>} DISTINCT chr(39)&[Customer Adj] &chr(39),',')

  2. your expression now will be: sum({$<[Customer Adj]={$(vCustomers)}, [Originating cl for order]-={'B', 'E','P'}, BilltoShiptoSales_Flag={0} >} [Cases_Aggr])