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
selected_
Helper IV
Helper IV

What's wrong the date or it's my data model?

I have a 3 tables with dates in each tables so I created a table just for DATE with this DAX code

 

DimDate_DAX = ADDCOLUMNS ( CALENDAR("2017-01-01",TODAY()), "Year", Year([Date]), "Quarter", CONCATENATE("Q",ROUNDUP(MONTH([Date])/3,0)), "Month", MONTH([Date]), "MonthName", FORMAT([Date],"MMMM"), "WeekNumber", WEEKNUM([Date]), "WeekDay",WEEKDAY([Date]), "Day", DAY([Date]), "DayName", FORMAT([Date],"DDDD") )

 
And then I created relationship between those date columns in other 3 tables to the new DATE table I just created, but in some visual and in some year it shows blank for some visual, but with own date table it works well.
 
I don't know if its the relashionship that are wrong, the Cardinality are set on Many to one and cross filter by Single. I have tried to change the Cardinality to One to Many but it says not vaild for this relationship
1 ACCEPTED SOLUTION

@selected_
What does your date look like in the orignal tables? It needs to match the date table EXACTLY. I typically use a DateKey in the format YYYYMMDD so that there is no ambiguous dates that don't match, especially if you are using date/time this can be important.

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

View solution in original post

4 REPLIES 4

Best practice is to create a calendar table containing all dates from the start of the year of the first date in all fact tables to the end of the year of the last date in all fact tables. Personally I never create date tables in DAX. You can copy my power query table from here 

https://exceleratorbi.com.au/build-reusable-calendar-table-power-query/

 

and read about calendar tables here https://exceleratorbi.com.au/power-pivot-calendar-tables/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

@MattAllington 

 

I tried your method but it still same issue.

I solved.

Issue was that the Date in the other table had also time inside so I removed the time and remain only day and year. 

@selected_
What does your date look like in the orignal tables? It needs to match the date table EXACTLY. I typically use a DateKey in the format YYYYMMDD so that there is no ambiguous dates that don't match, especially if you are using date/time this can be important.

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.