cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
PoweredOut Regular Visitor
Regular Visitor

Adding column from another table

Hi

 

I have two tables 1st table has a date and time column I would like to add two columns from the 2nd table based on the date/time column in the 1st table. I can only make a relatonship many to many using the month name in both table. 

 

I want to add the DateFrom and DateTo columns from Table 2 to Table 1. If Table 1 Date/Time 12/01/2019 is between Table 2 25/12/2018 and 24/01/2019 then add those two columns to Table 1.

 

I can't use merge in Query Editor as it will create doubles and my DAX knowledge is limited

 

Hope you can help

 

Thanks

 

Table 1

Date/Time             Year             Month

12/01/2019           2019            January

26/02/2019           2019            February

 

 

Table2

 

DateFrom                 DateTo               Year      Month

25/12/2018              24/01/2019        2019     January

25/01/2019              24/02/2019        2019     February

 

This is how Table1 should look like after adding columns from Table 2

 

Table 1

Date/Time             Year             Month            DateFrom          Dateto

12/01/2019           2019            January            25/12/2018       24/01/2019 

22/02/2019           2019            February          25/01/2019       24/02/2019

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Adding column from another table

Is this because you are joining on onyl one colunm months and there are several years so it is not unique 

 

if so then just create some new colunms on each of the table that combine your year and month colunms into one 

 

Colunm = concat(year,month)

 

add this to both tables and then create your join on this colunm and you should get your one to many relation ship and beable to look up based on this value.

 

 

2 REPLIES 2

Re: Adding column from another table

Is this because you are joining on onyl one colunm months and there are several years so it is not unique 

 

if so then just create some new colunms on each of the table that combine your year and month colunms into one 

 

Colunm = concat(year,month)

 

add this to both tables and then create your join on this colunm and you should get your one to many relation ship and beable to look up based on this value.

 

 

PoweredOut Regular Visitor
Regular Visitor

Re: Adding column from another table

Hi Anthony

 

the very thing!

 

Cheers

Joe


@AnthonyTilley wrote:

Is this because you are joining on onyl one colunm months and there are several years so it is not unique 

 

if so then just create some new colunms on each of the table that combine your year and month colunms into one 

 

Colunm = concat(year,month)

 

add this to both tables and then create your join on this colunm and you should get your one to many relation ship and beable to look up based on this value.