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
adamsumm
Frequent Visitor

Creating a Month/Year relationship for use in a slicer

Hello, 

 

I have two tables that I am trying to create a relationship to.  One is my key table used as a reference table for the date.  I want the date to span multiple years (this example shows 2017 through 2018).  

 

My other table shows my incident numbers and the date which it was created on.  

 

I have tried creating a 1 to many relationship between the date column and the opened at column.  For some reason my slicer will not work.  Both columns are formated as the data type Date.  

 

powerbi1.pngpowerbi2.pngpowerbi3.pngpowerbi4.png

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @adamsumm,

 

In date table, create a [Year Month] column like this:

Year Month = DateTable[date_year]&" "&DateTable[date_num]

Also, in incident table, create a [Year Month] column:

Year_Month = YEAR(Incidenttable[Open at]) & " " & MONTH(Incidenttable[Open at])

Please remove the original relationship, re-create a one to many relationship based on [Year Month].

1.PNG

 

Result

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @adamsumm,

 

In date table, create a [Year Month] column like this:

Year Month = DateTable[date_year]&" "&DateTable[date_num]

Also, in incident table, create a [Year Month] column:

Year_Month = YEAR(Incidenttable[Open at]) & " " & MONTH(Incidenttable[Open at])

Please remove the original relationship, re-create a one to many relationship based on [Year Month].

1.PNG

 

Result

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Check in Query Editor if these are originally coming in as DATE-TIME data values.

 

For some reason, changing the data type from DateTime to Date sometimes won't properly truncate.

 

Instead, go to the Transform tab in the Ribbon.

Date & Time Column section

Click Date

Date Only.

 

That will properly truncate the date.

 

Let us know if this works!

 

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.