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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
cm0215
New Member

Slice by year from 2 separate tables with independent date columns

Hello,

 

I have a dashboard created in Power BI Desktop and I am trying to filter by year for dates coming from date columns coming intwo separate tables.

 

E.g. I have a table for internal services and a table for external services and each service has a related date and metrics. I want to be able to slice my report based on year from both tables. I tried to build a relationship between these columns but get the error:

"You can't create a relationship between these two columns because one of the columns must have unique values."

 

How do I:

(a) Build a realtionship between these columns, or

(b) Merge the two columns into a 3rd separate date table column that will let me slice for my report?

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@cm0215

 

In this scenario, you can create a calendar table as @Vvelarde mentioned. And you can also add a service type column for each table and then merge these two tables. Please refer to following steps.

 

  1. In Query Editor, select ‘Internal Services’ table to add a custom column. Do the same for ‘External Services’ table.
    110.jpg
  2. Select ‘Internal Services’ table and click “Append Queries”.
    120.jpg
  3. Drag ‘Internal Services[Date]’ into Field of Slicer.
    130.png

View solution in original post

2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@cm0215

 

In this scenario, you can create a calendar table as @Vvelarde mentioned. And you can also add a service type column for each table and then merge these two tables. Please refer to following steps.

 

  1. In Query Editor, select ‘Internal Services’ table to add a custom column. Do the same for ‘External Services’ table.
    110.jpg
  2. Select ‘Internal Services’ table and click “Append Queries”.
    120.jpg
  3. Drag ‘Internal Services[Date]’ into Field of Slicer.
    130.png
Vvelarde
Community Champion
Community Champion

hi @cm0215

 

You need a calendar table.

 

You can create quickly with New Table - Calendar("InitDate";"FinalDate") Example: Calendar("01/01/2016"; "31/03/2016")

 

Then you make the relationship with this table and your date columns




Lima - Peru

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.