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

Create relationships using dates

Hello, I have two tables that I want to relate. The two tables have the same fields but one is for incomes and the other is for expenses correponding to the same year. I would like to relate the two tables so that when I hit quarter in the income table, for instance, I automatically see the correponding Q filtered in the expenses table.

 

How can I do that? If I want to create the relationship using the date field, PBI says that I need a unique field. Should I have to build an intermediate table to link them?

 

Thanks in advance.

4 REPLIES 4
ImkeF
Super User
Super User

I would recommend to append both tables instead. But before you do that, add a column called "Source" to your income table with "income" and the same with "expense" for your expenses table.

 

That way you just have one date-column and both values will be filters simultaneously.

Drag the field "Source" into your report in order to distinguish between both values.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Otherwise you would have to create a calendar/date-table to combine both tables on its date-field.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

aitorcalero
New Member

Hello, I have two tables that I want to relate. The two tables have the same fields but one is for incomes and the other is for expenses correponding to the same year. I would like to relate the two tables so that when I hit quarter in the income table, for instance, I automatically see the correponding Q filtered in the expenses table.

 

How can I do that? If I want to create the relationship using the date field, PBI says that I need a unique field. Should I have to build an intermediate table to link them?

 

Thanks in advance.

Hi @aitorcalero,

You can create a calendar table following the instructions in this blog, then create relationships between tables as ImkeF's post, you can check the example as follows.
1.PNG

After that, you can create visuals using date field from calendar table and related fields from income and expenses table, then filter the visual from quarter slicer.
2.PNG


For more deatils, you can review the example in the attached PBIX file.


Thanks,
Lydia Zhang

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

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.