Bullstrik1
Board Regular
- Joined
- Jul 31, 2014
- Messages
- 66
Hi everyone!
I'v been googling this issue for quite some time now, but I wasn't able to find anything related for porwer query so far, and thats why i'm counting with some of your experts help.
To the point:
I have 2 tables i would like to join, based on some date fields (I'm sorry about the unexistant formatting but i don't know how to post Excel tables in this forum, but i'll be glad to post an example excel workbook if you tell me how to :P )
Fact table:
[TABLE="width: 335"]
<tbody>[TR]
[TD]Ocurrence[/TD]
[TD]Object[/TD]
[TD]Entry Date[/TD]
[TD]Out Date[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]08-02-2017[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]07-02-2017[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]24-12-2016[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]15-01-2017[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD="align: right"]16-01-2017[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 249"]
<tbody>[TR]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
Dimensions table:
[TABLE="width: 287"]
<tbody>[TR]
[TD]Person[/TD]
[TD]Object[/TD]
[TD]DateFrom[/TD]
[TD]DateTo[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]15-02-2017[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01-12-2016[/TD]
[TD="align: right"]04-02-2017[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]31-12-2100
[/TD]
[/TR]
</tbody>[/TABLE]
From this 2 tables, i would like to create a join that would return the folowing table:
[TABLE="width: 581"]
<tbody>[TR]
[TD]Ocurrence[/TD]
[TD]Entry Date[/TD]
[TD]Out Date[/TD]
[TD]Person[/TD]
[TD]Object[/TD]
[TD]DateFrom[/TD]
[TD]DateTo[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]08-02-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]15-02-2017[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD][/TD]
[TD="align: right"]16-01-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01-12-2016[/TD]
[TD="align: right"]04-02-2017[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]31-12-2100[/TD]
[/TR]
</tbody>[/TABLE]
Note:
As you can see, sometimes Entry Date is null and there is no way one can retreive that information.
Anyone have an idea how one could do this using power query?
I saw this post with somehting similar to what i want to do but for SQL:
https://blog.oraylis.de/2014/11/com...d-fromto-date-ranges-into-a-single-dimension/
Hopefully it will provide some better insight on what i would like to do.
Thank you, in advance for your help and fr reading this post!
I'v been googling this issue for quite some time now, but I wasn't able to find anything related for porwer query so far, and thats why i'm counting with some of your experts help.
To the point:
I have 2 tables i would like to join, based on some date fields (I'm sorry about the unexistant formatting but i don't know how to post Excel tables in this forum, but i'll be glad to post an example excel workbook if you tell me how to :P )
Fact table:
[TABLE="width: 335"]
<tbody>[TR]
[TD]Ocurrence[/TD]
[TD]Object[/TD]
[TD]Entry Date[/TD]
[TD]Out Date[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]08-02-2017[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]07-02-2017[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]24-12-2016[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]15-01-2017[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD="align: right"]16-01-2017[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 249"]
<tbody>[TR]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
Dimensions table:
[TABLE="width: 287"]
<tbody>[TR]
[TD]Person[/TD]
[TD]Object[/TD]
[TD]DateFrom[/TD]
[TD]DateTo[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]15-02-2017[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01-12-2016[/TD]
[TD="align: right"]04-02-2017[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]31-12-2100
[/TD]
[/TR]
</tbody>[/TABLE]
From this 2 tables, i would like to create a join that would return the folowing table:
[TABLE="width: 581"]
<tbody>[TR]
[TD]Ocurrence[/TD]
[TD]Entry Date[/TD]
[TD]Out Date[/TD]
[TD]Person[/TD]
[TD]Object[/TD]
[TD]DateFrom[/TD]
[TD]DateTo[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]08-02-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]15-02-2017[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]15-01-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD][/TD]
[TD="align: right"]16-01-2017[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]01-01-2017[/TD]
[TD="align: right"]31-01-2017[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]24-12-2016[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01-12-2016[/TD]
[TD="align: right"]04-02-2017[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]07-02-2017[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]05-02-2017[/TD]
[TD="align: right"]31-12-2100[/TD]
[/TR]
</tbody>[/TABLE]
Note:
As you can see, sometimes Entry Date is null and there is no way one can retreive that information.
Anyone have an idea how one could do this using power query?
I saw this post with somehting similar to what i want to do but for SQL:
https://blog.oraylis.de/2014/11/com...d-fromto-date-ranges-into-a-single-dimension/
Hopefully it will provide some better insight on what i would like to do.
Thank you, in advance for your help and fr reading this post!