Forum Discussion
Date in relationship
I have 2 tables, One is DimDate, other one if FactTable with the date column that has "Date" type . When I make relation between Date columns in these two tables, The type of date column in Fact table will change automatically and it's not date more.
What's wrong?
5 Replies
- rajendraongole1Super User
Hi mariakn6 - Crosscheck, the if there is any mismatched data types between the DimDate and FactTable date columns or due to ambiguity introduced by the column's formatting or data structure.
Navigate to the Modeling tab in Power BI.
Select the column in question.
Change the data type to Date for both columns.or you can also fix it at power query editor
Go to Home > Transform Data to open Power Query Editor.
Select the FactTable date column.
Remove or replace any non-date values.
Set the column’s data type explicitly to Date.
Apply changes and close Power Query Editor.or
Delete the existing relationship between DimDate and FactTable.
After ensuring both columns are of the same type (Date), recreate the relationship:
Drag the date column from DimDate to the corresponding column in FactTable in the Model view.
Set the relationship as Many-to-One (Single) and ensure the cardinality and cross-filter direction are correct.Hope the above details helps to fix the issue.
- mariakn6New Member
Thank you for your prompt reply. Of course I chacked data types before. I attached some photos here.
Please take a look as it never happend for me before.
Call center is my Fact table and you can see Call Date field after relation.
- Kedar_PandeSuper User
- Check the data types of both the Date columns. In the FactTable, the Date column should be set to Date type. In the DimDate table, the Date column should also be Date.
- Ensure there are no time values in the FactTable[Date] column before creating the relationship, as Power BI might interpret it as a Date/Time type, which can cause issues.
💌 If this helped, a Kudos 👍 or Solution mark ✅ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn - mariakn6New Member
Thank you for your prompt answer,
As you can see, both columns are Date.
But in Call Center table, you can see call date is not determin as Date in field list