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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors