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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
cparker4486
Helper III
Helper III

Date table - Why can't I make a relationship?

I come across this issue every time I try to do it. I eventually stumble across the answer but each time I start over and try again I get stuck.

 

The scenario is that I'm trying to create a Date table and establish relationships to other tables. Creating the Date table itself is easy.

 

DateAccounts = 
ADDCOLUMNS (
CALENDARAUTO(),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)

 

The hard part is in creating the relationship.

 

I've set the date columns in both tables to exactly the same thing:

 

  • Data Type: Date
  • Format: 2001-03-14 (yyyy-MM-dd)

I've created a many-to-one relationship from Accounts to DateAccounts.

 

11_08_05-Dynamics CRM 3 - Power BI Desktop.png

 

Then I make a bar chart and set the Value to "Accounts.Count of ID" and the Axis to DateAccounts.Date but the chart is blank.

 

11_15_17-February - OneNote.png

 

If I drill-down down to Quarter, I get a bar called (Blank). Obviously, a relationship has not been made.

 

11_16_02-Dynamics CRM 3 - Power BI Desktop.png

 

This happens to me every time. Why don't the values align? What magic (obvious mistake more likely) am I missing?

 

If I keep messing with it I'll eventually change the magic bit and it will work. I just wish I could learn what the problem is so I don't have to hit this brick wall each time. This should be straightforward.

1 ACCEPTED SOLUTION

my recommendation will be to add DateAsInteger field in your data table as well and link with calendar table on DateAsINteger field. let's try this first and see what happens?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
dkay84_PowerBI
Microsoft Employee
Microsoft Employee

First, see what happens if you change the date field in the axis from "hierarchy" to "date".

 

Also, try changing the relationship direction from single to both.  It is possible that the relationship you have is flowing from the fact table to the dimension table, so that when you put dimDate as the axis, it is not passing the filter argument to the fact table.

 

Also, make sure that the data types are the same for both date fields.

my recommendation will be to add DateAsInteger field in your data table as well and link with calendar table on DateAsINteger field. let's try this first and see what happens?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k

 

Yes. This actually works!

 

There really seems to be some "magic" happening in the background that is making Power BI behave in a non-obvious way.

Good to hear 🙂 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

This happens when the data in your Accounts table can't find the corresponding record in your date table.

 

Is CalendarAuto working?  What are the oldest and newest dates in your calendar table?  


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

This happens when the data in your Accounts table can't find the corresponding record in your date table.

 

I know. That's why I made this post.

 

Is CalendarAuto working?  What are the oldest and newest dates in your calendar table?

 

Yes.

Also what happens when you drag [Created On] to the axis of your visual?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Also what happens when you drag [Created On] to the axis of your visual?

 

I get more wacky behavior from Power BI.

 

  1. It automatically identifies itself as a date hierarchy but shows the axis as if it's an integer.
    15_08_39-Dynamics CRM 3 - Power BI Desktop.png
  2. If I change it to "createdon" I don't even know what it's doing. I expect it to be grouping by createdon per createdon. So two events on the same day should appear as one vertical bar, two units tall. But it doesn't. It looks like it's grouping per minute or something. I can't tell.
    15_11_11-Dynamics CRM 3 - Power BI Desktop.png

Hi @cparker4486,

 

Is there any chance you can share a cut down version of your PBIX file?  I'd love to take a look and try and see why the visuals are mis-behaving for you.

 

Feel free to PM me a link to the file.

 

Cheers,

 

Phil


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi Phil,

 

Thanks for the offer! That shouldn't be a problem. I'll message you some time this week.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors