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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

IF formula with column from another table

Hi,

 

I am trying to build formula that will calculate last column in example shown in desired result table. The problem is that value column comes through 1 to many relationship from other table.

 

I have tried related and relatedtable, without any luck.

 

Desired table outcome

IDcodevalueDesired outcome for value
a111111313
a222224343
a3#22NA
a444448282

 

Other table connected with one to many relationship.

IDvalue
a113
a243
a322
a482

 

So, basically i just need to change content of value column according to code column. Normally I would use IF( ) but I dont know how to access this other column from another table.

 

I would apreciate any suggestions 🙂

Thank you.

2 ACCEPTED SOLUTIONS

you can get a new column like this

New column in Table 1 = if(table1[code]="#","NA",maxx(filter(table2,table1[ID] = table2[ID]) ,table2[value]))

View solution in original post

Anonymous
Not applicable

@amitchandak 

 

Work like a charm, thank you a lot!

 

I was even able to make it more complex.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Not very clear. But this how you copy columns from one table to another

New column in Table 1 = maxx(filter(table2,table1[customer] = table2[customer] && table2[option]="construction",table2[value])

New column in Table 1 = maxx(filter(table2,table1[Attribute] = table2[name] && table1[project] = table2[project]),table2[name])
Anonymous
Not applicable

Hey, thank you for replying.

 

I have tried your formula, but it doesn't really work and I don't really understand it. When I am trying to write this formula in the original table, table1[customer]  does not find anything. 

 

What I am trying to achieve is to get access based on vallue in table 1 to value from column in table2. I already have the relationship established.

 

I would like something like:

IF( value in code == "#", NA, get value from columns in table2)  based on the established relationship.

you can get a new column like this

New column in Table 1 = if(table1[code]="#","NA",maxx(filter(table2,table1[ID] = table2[ID]) ,table2[value]))
Anonymous
Not applicable

@amitchandak 

 

Work like a charm, thank you a lot!

 

I was even able to make it more complex.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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