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
yuhkao
Employee
Employee

calendar table to relationship linkage

Hi Expert

 

I have 2 tables for different date format and would like to link with calendar table 

 

Table1

Date                                  Data

Tuesday, May, 5, 2020      100

Monday, May, 4, 2020      200

...

...

...

 

 

 

Table2

Date         Data

202005     100

202004     200

202003     300

202002     400

 

 

Calendar Table

multiple dimension date format

 

 

question: can I have link relationship with two table based on different format date? thanks 

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @yuhkao ,

 

Based on my test, the column that related in the relationship should be the same data type even though they are in different format.

 

But in your Table2, the Date column is whole number type and it cannot be converted to the date type(or be converted to the wrong date). You should check for it first.

 

Best Regards,

Dedmon Dai

AllisonKennedy
Super User
Super User

Both data type and format should match to use relationships. I always create a DateKey to use as my relationship linkage between tables. You can do this in the Query Editor by adding a custom column and using the formula:
=Date.ToText([Date], "YYYYMMdd")

 

For your Table 2 you may have to do a bit more cleansing to convert it into a date data type first. 

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.