finding the latest date where sales exist for all customers (in script)
i need to update a variable in the script that holds the latest date where sales exist for all customers.
basically, i load in data for all of the customers, some customers are quicker at supplying data than others, i only want to report on the latest date where i have received data for everyone. i need to get this done in the script then once i have found the latest date i need to store the date in a variable. i then want to use the variable later in the script to create some flags against dates.
I am looking for help to get the script written to find the latest date first.
can anyone help please?
i have attached a sample and included a sample excel file with 2 customers in it.
the excel file has data for Cust A that goes from 04/01/2016-27/11/2016 and data for Cust B from 04/01/2016- 09/10/2017.
so the resulting variable should state 09/10/2017 as this is the last date that data has been received for both customers.
Yes, and I am guessing that OP will already know what is the max number of customer.... this can be hard-coded or calculated in the script... but again based on the assumption that we know the max number of customer, we can very easily use a variable in the where clause
Well then if that is the case and this number can go up and down, then neither of our calculations are probably going to work. The basis of both of our scripts resides on the fact that number of customers are not going to change very often, because if it does, then how do you really know which number is correct... for example
May 2017 10
June 2017 8
July 2017 10
August 2017 8
September 2017 7
Now, which one would you say is the correct Month? It could be August because the number of customer went down by 2 or it could be September because customer went down another one.
My point is, that if we can hard-code something to simplify our script.... we should do it... because Group Bys are resource intensify and I would want to avoid it as much as possible