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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Relationship between tables to bring data from the current year and previous year

Good morning.

I have 2 tables (sales table and costs table) related by a year-month concatenation. I can't bring all the data in the cost table to the sales table. Let me explain myself by examples:

I have 2 tables, one of sales and one of costs:

Sales table
yearmysalesAA sales
20221100

75

20222200175
20233300350

Cost table
yearmycost
2022150
20222125
20223180
2021130
2021295
20213150

I have related both tables using a column in which there is a year-month concatenation formula.

I have managed to bring to the sales table the data of the cost table referring to the year 2022, but not those of 2021.

yearmysalesAA salescostAA cost
202211007550
20222200175125
20233300350180

My goal is to also be able to bring the cost data for 2021, so that the final table is like this:

yearmysalesAA salescostAA cost
20221100755030
2022220017512595
20233300350180150

How can I get this table? I could solve it by making a copy of the cost table and leaving the original cost table with the 2022 data and the new table with the 2021 costs and relating both tables to the sales table, but it seems impractical to me.

Thank you

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.