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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

If statement for columns in two tables

Hi experts, I can’t work out on how to create a calculated column using 2 columns from different tables.

 

I’m trying to create a calculated column using If statement:

Column "Amount" and column "currency code" is in table 1

Column "new currency code" is in table 2

 

Both tables are linked together on company ID column.

 

When creating column "Final currency code" in table 1 using condition as

= if ( Amount=0;  Currency code ; new currency code) ;  columns from second table is not shown up

 

There is a relationship between both tables .

 

Any ideas?

Thanks,

Neha.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

I believe you want:

 

Column = if ( [Amount]=0;  [Currency code] ; RELATED([new currency code])) ; 

 

Make sure that you are doing this in DAX and not Power Query. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
RajMalhotra1984
Frequent Visitor

Hi I have a similar situation but no solution-

 

I have 1324 equipment numbers in table 1 all are unique values.

Then I have 1174 equipment number in table 2 all are unique values.

 

These equipment numbers are connected in the relation table.

 

Table 2 has Hours of work in a coloumn for each equipment.

 

What I intend to do is create a custom coloumn in table 1 where I can bring the hours of work for each equipment from table 1 and then where ever we don't have hours available in table 2 (1324-1174 = 150 equipments will have no hours as they don't exist in table 2). I want the custom coloumns to show 0 hours for these 150 equipments. Can you help.

Greg_Deckler
Super User
Super User

I believe you want:

 

Column = if ( [Amount]=0;  [Currency code] ; RELATED([new currency code])) ; 

 

Make sure that you are doing this in DAX and not Power Query. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank You Greg !

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.