Forum Discussion
LPSUCSF
Jan 22, 2020Copper Contributor
Merge 2 datasets by common id field AND 2 dates if they are within 365 days of each other
Hi, I have 2 datasets that I would like to merge together. There is a common id field between the two but I need the two datasets to also align by date. There is no common date field. One dataset...
ChrisMendoza
Jan 22, 2020Iron Contributor
LPSUCSF
Jan 22, 2020Copper Contributor
ChrisMendoza That's great! What did you do? Thank you!
- ChrisMendozaJan 22, 2020Iron Contributor
LPSUCSF -
Data > Queries & Connections > Right-Click Edit to see what was done in the Query Editor.
In the Step 'Added Custom' I added IF ELSE logic as:
if Duration.Days([Dataset2.completeddate]-[createddate]) > 365 then null else if Duration.Days([Dataset2.completeddate]-[createddate]) <= 0 then null else Duration.Days([Dataset2.completeddate]-[createddate])Producing:
Then just filtered out NULL.
- LPSUCSFJan 22, 2020Copper Contributor
ChrisMendoza Hi. I'm not familiar with Power Queries. Could you please provide a link to how you did this? I am unable to follow what you did. I don't see Queries and Connections in my Data tab. I see only Connections. Thank you.
- ChrisMendozaJan 22, 2020Iron Contributor