Forum Discussion

adoster's avatar
adoster
Resolver I
4 years ago
Solved

Create new Column: values based on column header (year) from another table

Hello,   I'm trying to create a new column with values from another table, based on an ID & the column header which is a date/year value. Tables are linked via "Code"   Table A Name Code D...
  • ddpl's avatar
    4 years ago

    adoster 

     

    Create a calculated column...

     

    Value = SWITCH(TRUE(),
                      FORMAT('Table A'[Date], "yyyy") = "2019", LOOKUPVALUE('Table B'[2019]'Table B'[Code]'Table A'[Code]),
                      FORMAT('Table A'[Date], "yyyy") = "2020", LOOKUPVALUE('Table B'[2020], 'Table B'[Code], 'Table A'[Code]),
                      FORMAT('Table A'[Date], "yyyy") = "2021", LOOKUPVALUE('Table B'[2021], 'Table B'[Code], 'Table A'[Code])
    )
     
    Hope it will work for you.