Forum Discussion

marktait's avatar
marktait
Helper I
2 years ago
Solved

Transform Data - add a column count based on another table

Hi. I have a table "DeviceList (2)" which has a column, [Device Name].   I would like (in Transform Data -> Add New Column) to look for the "Device List (2)"[Device Name] within the "Defender SNOW...
  • nsexton12's avatar
    nsexton12
    2 years ago

    I think I have figured out your issue. It looks like you did not need the list functions as you could do the operations on the tables themselves. I think using the List function is what was causing the cyclical reference because as soon as I removed them they went away. Please see code below that I think solves your issue: 

     

    if Table.RowCount(Table.SelectRows(
    #"Defender SNOW",
    (row) => Text.Contains( row[Short description],[Device Name])
    )) = 0
    then 0
    else Table.RowCount(Table.SelectRows(
    #"Defender SNOW",
    (row) =>Text.Contains( row[Short description],[Device Name])
    ))

     

    If anyone else can provide a more techincal explanation for why this caused a cyclical reference, please feel free to add on. 

     

    Please mark as a solution if this worked for you!