In my example bellow I need help in demonstrating that a patient had a fill in January and should be included the February count:
In put
Patient | Month | |
1 | Month_Year | Refills |
1 | 1/1/2018 | 2 |
1 | 3/1/2018 | 2 |
1 | 4/1/2018 | 1 |
1 | 5/1/2018 | 1 |
1 | 6/1/2018 | 1 |
1 | 7/1/2018 | 1 |
1 | 8/1/2018 | 1 |
Output: How to transform the data
Patient | Month | |||
1 | Month_Year | Refills | Month Year | Count Value |
1 | 1/1/2018 | 2 | Jan-18 | 1 |
1 | Null | 0 | Feb-18 | 1 |
1 | 3/1/2018 | 2 | Mar-18 | 1 |
1 | 4/1/2018 | 1 | Apr-18 | 1 |
1 | 5/1/2018 | 1 | May-18 | 1 |
1 | 6/1/2018 | 1 | Jun-18 | 1 |
1 | 7/1/2018 | 1 | Jul-18 | 1 |
1 | 8/1/2018 | 1 | Aug-18 | 1 |
Solved! Go to Solution.
@Carolyne See if the attached gets you pointed in the right direction. I'm using a summarize to get the min and max dates. Then I use generate rows to get all of the months in between. Then I join that list to the original dataset.
Thanks!