Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community!
I have the following two tables
Main Table
Key - Unique | Primary Date |
AAA | 01/24/2019 |
BBB | 04/19/2019 |
Second Table
Key - Non Unique | Secondary Date |
AAA | 12/23/2018 |
AAA | 01/20/2019 |
BBB | 01/30/2019 |
AAA | 03/20/2019 |
BBB | 05/20/2019 |
In my load script I am trying to add another column onto Main Table that is informed by the Secondary Table in the following way :-
Displays '1' if the Key in the Secondary Table has a date within a certain range (e.g. in the same month) of the primary date of the Key in the Primary Table. Displays '0' otherwise.
In the above example, AAA would have a '1' as Secondary Date 01/20/2019 falls one week around Primary Date 01/24/2019. BBB would have a '0'.
How would this be possible?
When I say way around, you can use Aggr()... in your example Sum(Aggr(Value, Key))
I don't particularly like synthetic keys as they make the table look messy but in this case I would leave them to avoid any potential issue of data integrity
Agreed
Thank you gentlemen