Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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.

  • 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's avatar
    Anonymous
    6 years ago

    amitchandak 

     

    Work like a charm, thank you a lot!

     

    I was even able to make it more complex.

4 Replies

  • 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's avatar
      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.

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        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]))