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
Cooper01
New Member

Can't get date relationship/changing column type to date only to work

Hi all, brand new to Power BI. I am trying to create a date table and then a relationship between that and one of the tables (Sales) from my data source. Initially I created the table (calling Calendar) using the CalendarAuto() function and then added some other columns like year, month, etc. I then went to create the relationship between my date columns in Calendar and Sales. 

I created a table visual where the values were Total (a column in Sales) and Year (from Calendar). I changed Year in the Values section to Don't Summarize. It just shows a blank year and all sales, leading me to believe there is an issue with the relationship.

Based on some initial googling I think my issue is that the date field I am using from Sales is actually a date time, so I don't think it can find a match from Calendar dates. Therefore I added a new column to my Sales table and set it to the original date time field, and then changed the Data type of my new field to Date.

I then removed my relationship and created it between the date field in Calendar and my new custom column in Sales, however all years are still blank.

Am I going about changing the column type incorrectly? Is there anything else I might be missing here? Thanks in advance.

1 ACCEPTED SOLUTION
Cooper01
New Member

@Ashish_Mathur @v-stephen-msft thank you both for the replies and sorry for the slow response. The issue was that the date time column I was using as my date column reference was not truly a date time but text. Didn't notice because it looked like a date time and there was no issues creating a date column from that. Once I changed the reference field to a true date/time, it worked.

View solution in original post

3 REPLIES 3
Cooper01
New Member

@Ashish_Mathur @v-stephen-msft thank you both for the replies and sorry for the slow response. The issue was that the date time column I was using as my date column reference was not truly a date time but text. Didn't notice because it looked like a date time and there was no issues creating a date column from that. Once I changed the reference field to a true date/time, it worked.

v-stephen-msft
Community Support
Community Support

Hi @Cooper01 ,

 

It may be caused by the wrong filter direction of the relationship.

You can refer to this official document.

It is recommended to change the Cross filter direction to Both to try.

candmrel_create_compproj.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

It looks like you have performed the correct steps.  Share the link from where i can download your PBI file.  If you imported data into the PowerBI Desktop file from an MS Excel file, then i will need that MS Excel file as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.