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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jmmariscal
Frequent Visitor

How to create a column with a calculation from two tables

Hi,

 

I have a table (A) with a column for a date month, and a column with a static value per each month.

On the other hand, I have a table (B) cost and date month.

 

I want to create a new calculated column as follow:

 

Column = A[staticValue]*B[cost]. 

 

Example:

 

A

02/2021 23.4

03/2021 3.5

 

B

02/2021 2500

03/2021 1400

 

CalcultatedColum:

23.4*2500

3.5*1400

 

Thank you in advance

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jmmariscal 

you can create a relationship between the two tables using month-year column from both tables. It looks from the example you've provided that this relationship shall be one-one relationship. 
then you can use the following code to create the calculated column:

If the coulm is in table A:

Column = A[staticValue] * RELATED ( B[cost] )

if the column is in table B:

Column = B[cost] * RELATED ( A[staticValue] )

please try to create the relationship and let me know if you need any help. 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @jmmariscal 

you can create a relationship between the two tables using month-year column from both tables. It looks from the example you've provided that this relationship shall be one-one relationship. 
then you can use the following code to create the calculated column:

If the coulm is in table A:

Column = A[staticValue] * RELATED ( B[cost] )

if the column is in table B:

Column = B[cost] * RELATED ( A[staticValue] )

please try to create the relationship and let me know if you need any help. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.