Hi,
Currently working on a report where I have to find the cash short/over.
Basically we have sales data (Table 1) and bank deposits data (Table 2) and trying to find the amount variance.
Challenge is Bank deposits data we don't have the sales date. So basically we don't have any fields which we can use to join them.
The logic is we have to find the nearby date and nearby value.
Below is sample data-
| Table1 | Table 2 | |
| Sale Date | Cash Collected | Deposit Date | Bank Deposit | Variance |
| 2019-06-03 | 199.08 | 2019-06-07 | 199.62 | 0.54 |
| 2019-06-04 | 147.99 | 2019-06-07 | 147.97 | -0.02 |
| 2019-06-05 | 129 | 2019-06-07 | 129.8 | 0.80 |
| 2019-06-06 | 180.83 | 2019-06-07 | 180.94 | 0.11 |
| 2019-06-07 | 177.94 | 2019-06-10 | 171.82 | -6.12 |
| 2019-06-08 | 166.19 | 2019-06-10 | 165.71 | -0.48 |
| 2019-06-09 | 219.75 | 2019-06-10 | 219.16 | -0.59 |
| | 1220.78 | | 1215.02 | -5.76 |
| | | | | |
| Sale Date | Cash Collected | Deposit Date | Bank Deposit | Variance |
| 2019-06-10 | 117.6 | 2019-06-14 | 114.82 | -2.78 |
| 2019-06-11 | 125.73 | 2019-06-14 | 128.24 | 2.51 |
| 2019-06-12 | 137.6 | 2019-06-14 | 137.61 | 0.01 |
| 2019-06-13 | 183.18 | 2019-06-14 | 183.79 | 0.61 |
| 2019-06-14 | 161.26 | 2019-06-17 | 161.15 | -0.11 |
| 2019-06-15 | 247.71 | 2019-06-17 | 248.92 | 1.21 |
| 2019-06-16 | 205.44 | 2019-06-17 | 199.93 | -5.51 |
| | 1178.52 | | 1174.46 | -4.06 |
Any help would be appreciated.
Regards,
Irfan