Hello,
I'm trying to create a straight table to show me historic forward sales.
I want to see the sum of Sales_QTY where the Order_Date is before a date and the Shipping_Date is after the date.
Example: If the Order_Date is 2022-01-01 I want to sum all Sales_QTY where the Order_Date is smaller than 2022-01-01 and Shipping_Date is greater than 2022-01-01.
DataSet:
Order_ID |
Order_Date |
Shipping_Date |
Sales_QTY |
12345 |
2022-01-01 |
2022-01-02 |
12 |
12346 |
2022-01-01 |
2022-01-05 |
15 |
12347 |
2022-01-03 |
2022-01-06 |
24 |
12348 |
2022-01-03 |
2022-01-09 |
14 |
12349 |
2022-01-05 |
2022-01-06 |
3 |
12350 |
2022-01-05 |
2022-01-08 |
6 |
12351 |
2022-01-07 |
2022-01-07 |
14 |
12352 |
2022-01-07 |
2022-01-10 |
8 |
12353 |
2022-01-09 |
2022-01-11 |
15 |
12354 |
2022-01-09 |
2022-01-10 |
7 |
12355 |
2022-01-09 |
2022-01-14 |
6 |
Desired Result:
Order_Date |
Sales_QTY |
2022-01-01 |
0 |
2022-01-03 |
15 |
2022-01-05 |
38 |
2022-01-07 |
20 |
2022-01-09 |
8 |