Hello,
I have a table with a date column. The date is intermittent, and need to fill the missing date with the value of zero (0).
I am thinking that I need to list date into a separate table, and merge (full) with the product table for each product, replace null with 0.
Any thoughts about what can be done better?
Thanks,
T
Here is the example:
input:
Expected output:
I have a table with a date column. The date is intermittent, and need to fill the missing date with the value of zero (0).
I am thinking that I need to list date into a separate table, and merge (full) with the product table for each product, replace null with 0.
Any thoughts about what can be done better?
Thanks,
T
Here is the example:
input:
Date | Product | Value |
5/10/2017 | A | 1 |
5/15/2017 | A | 2 |
5/11/2017 | B | 3 |
5/16/2017 | B | 4 |
Expected output:
Date | Product | Value |
5/10/2017 | A | 1 |
5/11/2017 | A | 0 |
5/12/2017 | A | 0 |
5/13/2017 | A | 0 |
5/14/2017 | A | 0 |
5/15/2017 | A | 2 |
5/16/2017 | A | 0 |
5/10/2017 | B | 0 |
5/11/2017 | B | 3 |
5/12/2017 | B | 0 |
5/13/2017 | B | 0 |
5/14/2017 | B | 0 |
5/15/2017 | B | 0 |
5/16/2017 | B | 4 |