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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
kman42
Frequent Visitor

Add values from two tables that share a date

I have two tables. 

 

Table 1:

Date

Amount

1/1/2024

50

2/1/202460
3/1/202470
4/1/202480
5/1/202490

 

Table 2:

DateOffset
2/1/202410
3/1/202420
4/1/202430

 

I'd like to get a table like this:

DateAmount + Offset
1/1/202450
2/1/202470
3/1/202490
4/1/2024110
5/1/202490

 

I think this should be easy, but I've spent several hours without figuring it out. Any help would be appreciated.

 

Thanks!

3 ACCEPTED SOLUTIONS
MattAllington
Community Champion
Community Champion

There are various approaches. Regardless of which approach, you should get a calendar table. 
https://exceleratorbi.com.au/power-bi-calendar-tables/

 

then you can either join the calendar table to bith of the tables to have (one to many), use the calendar table in your visual and then write a measure = sum(table1[amount]) + sum(table2[offset])

 

or, if it were me, and if the tables actually look like those you posted (ie, there's nothing your holding back and not telling me), I would do the following 

 

in power query, create transform table 1 to be like

date, attribute, amount

1/1/24, "Amount", 450

etc

table 2, exactly the same headers but put "offset" as the attribute 

 

append the 2 tables together and load a single table

 

still join to the calendar table as above.

you can simply drag the amount column into the values section and even use the attribute column in your visual. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

HamedM1125
Advocate III
Advocate III

Hello @kman42 

You can acheive this doing by following steps:

1. Create a Date Table by going to modelling and in the new table add the following dax:

Date =
ADDCOLUMNS (
CALENDAR( "1/1/2024", "12/31/2024"),
"ShortDate", FORMAT([Date], "DD-MMM"),
"Date_Date", FORMAT([Date], "MM/DD/YY"),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYYMM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)

2. Create a relantionship between Date and other tables:

HamedM1125_0-1730534797129.png


3. Create a measure:

Amount + Offset =
Var A = SUM('Table 1'[Amount])
VAR B = SUM('Table 2'[Offset])
RETURN
A + B

4. Result:

HamedM1125_1-1730534871886.png

Let me know if you got this. Kudos!






View solution in original post

FreemanZ
Community Champion
Community Champion

hi @kman42 ,

 

To start less stressfully, you can add a calculated column in table1 like this:

Column =

[Amount] +

LOOKUPVALUE(

    table2[offset],

    table2[date],

    table1[date]

)

View solution in original post

3 REPLIES 3
FreemanZ
Community Champion
Community Champion

hi @kman42 ,

 

To start less stressfully, you can add a calculated column in table1 like this:

Column =

[Amount] +

LOOKUPVALUE(

    table2[offset],

    table2[date],

    table1[date]

)

HamedM1125
Advocate III
Advocate III

Hello @kman42 

You can acheive this doing by following steps:

1. Create a Date Table by going to modelling and in the new table add the following dax:

Date =
ADDCOLUMNS (
CALENDAR( "1/1/2024", "12/31/2024"),
"ShortDate", FORMAT([Date], "DD-MMM"),
"Date_Date", FORMAT([Date], "MM/DD/YY"),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYYMM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)

2. Create a relantionship between Date and other tables:

HamedM1125_0-1730534797129.png


3. Create a measure:

Amount + Offset =
Var A = SUM('Table 1'[Amount])
VAR B = SUM('Table 2'[Offset])
RETURN
A + B

4. Result:

HamedM1125_1-1730534871886.png

Let me know if you got this. Kudos!






MattAllington
Community Champion
Community Champion

There are various approaches. Regardless of which approach, you should get a calendar table. 
https://exceleratorbi.com.au/power-bi-calendar-tables/

 

then you can either join the calendar table to bith of the tables to have (one to many), use the calendar table in your visual and then write a measure = sum(table1[amount]) + sum(table2[offset])

 

or, if it were me, and if the tables actually look like those you posted (ie, there's nothing your holding back and not telling me), I would do the following 

 

in power query, create transform table 1 to be like

date, attribute, amount

1/1/24, "Amount", 450

etc

table 2, exactly the same headers but put "offset" as the attribute 

 

append the 2 tables together and load a single table

 

still join to the calendar table as above.

you can simply drag the amount column into the values section and even use the attribute column in your visual. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.