Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
AnthonyTilley
Solution Sage
Solution Sage

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.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
AnthonyTilley
Solution Sage
Solution Sage

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.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

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.

 

 


 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.