Forum Discussion

primolee's avatar
primolee
Helper V
4 years ago
Solved

Using column value as table name as a parameter to trigger a function

Hello everyone,   I have several queries that I would like to count their rows and store in a different table.   I have created a one-column table with the query names in the column.  I want to a...
  • primolee's avatar
    4 years ago

    I got it working.

     

    Create a new column using the following code:

    Table.AddColumn(previousStepName, "RowCount", each Table.RowCount(Record.Field(#shared,[Table Name])))

     

    However, I think #shared still does not work in BI Service, so alternative is to create a record listing function names:

    tableList = [
         #"Query A" = #"Query A",
         #"Query B" = #"Query B",
         QueryC = QueryC,
    ],

     

    Then, change #shared to tableList:

    Table.AddColumn(previousStepName, "RowCount", each Table.RowCount(Record.Field(tableList,[Table Name])))

     

    This will work on Power BI Service and refresh with no problem.