Forum Discussion

Brenda_Loznik's avatar
Brenda_Loznik
Advocate II
8 months ago
Solved

UDF with variable table reference and fixed column reference

Hi all, I'm trying to create a user-defined function in DAX where the function receives a table as an input parameter, and then uses that table inside the function. The function is supposed to work ...
  • v-prasare's avatar
    8 months ago

    Hi Brenda_Loznik,

    this is a known DAX limitation and expected behavior, While you can pass a table as a parameter to a DAX user-defined function, DAX does not allow referencing columns with table-qualified notation (Table[Column]) inside the function when the table is coming from a parameter.

     

    To make it work, you first need to rebuild the column names inside the function using SELECTCOLUMNS, and then you can use them normally.

     

     

    Thanks,
    Prashanth

  • v-prasare's avatar
    8 months ago

    Hi Brenda_Loznik,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by community members for your issue worked for you or let us know if you need any further assistance?

     

     

    Your feedback is important to us, Looking forward to your response

    Thanks,

    Prashanth

  • Brenda_Loznik's avatar
    5 months ago

    In case anyone else runs into the same issue,  After the february 2026 update I now have a working solution:

        function my_function =
                (
                InputTable : ANYREF EXPR
                            ) =>

                var TableName =  TABLEOF ( InputTable)

                RETURN 
      -- Here you can put the logic that you want to repeat for every InputTable --