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

Referring to another Table by calculating average

Hi community,

 

I have the following case:

 

Sales

DateSalesNew Column (average Temperature)
2024-01500 
2024-02300 
2024-03400 

 

Weather_data:

Datetemperature
2024-013
2024-015
2024-012
2024-023
2024-0211
2024-032
2024-033

 

The tables are connected (Column: date)

 

I want to create a new calculated Columnin table Sales, which calculates the average temperature each month. In this case, table Weather_data has multiple rows for each month and table Sales only has 1 row each month.

 

Example for first row (2024-01) in "Sales": 3+5+2 => average =>3.33

Example for second row (2024-02) in Sales: 3+11 => average => 7

Example for third row (2024-03) in Sales: 2+3 => average => 2.5

 

Expected result for the new column in table "Sales": 

DateSalesNew Column (average Temperature)
2024-015003.33
2024-023007
2024-034002.5

 

What would be the DAX function for the new calculated column?

 

Thank you!

 

Best

 

1 ACCEPTED SOLUTION
Corey_M
Resolver II
Resolver II

Based on your sample data it would be this 

Avg Temp = 
CALCULATE(
AVERAGE(Weather_data[temperature]),
FILTER(
    Weather_data,
    Weather_data[Date] = Sales[Date]
))

Corey_M_0-1717424342028.png

however this was based on the date column you provided, if you are using an actual date instead of the year-month text in Weather_data I would highly recommend adding a calendar table.

View solution in original post

1 REPLY 1
Corey_M
Resolver II
Resolver II

Based on your sample data it would be this 

Avg Temp = 
CALCULATE(
AVERAGE(Weather_data[temperature]),
FILTER(
    Weather_data,
    Weather_data[Date] = Sales[Date]
))

Corey_M_0-1717424342028.png

however this was based on the date column you provided, if you are using an actual date instead of the year-month text in Weather_data I would highly recommend adding a calendar table.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors