Forum Discussion
DAXUDF Reference a column
So, i want to make a DAX UDF that takes a (one-column) table as input and outputs a concatenation of all distinct values.
Something like:
DEFINE FUNCTION
ConcValues = (column: Table) => CONCATENATEX( DISTINCT(column), ???columnName???, ", ")
Since i can pass any table, the column name is variable and cannot be hard-coded in the UDF.
Any ideas how to implement this? How to make a reference to a column name? Or how to reference the column of a table by a number, i.e. the 2nd column of the table or the first column, etc)
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file, and please try something like below.
3 Replies
- Jihwan_KimSuper User
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file, and please try something like below.
- nyarlathotepAdvocate I
Jihwan_Kim that works! I could have sworn that i had tried anyref but i must have messed somewhere else - my actual measure is a bit more complex that the simplified version i posted here. Anyway, problem solved, thanks mate!
- nandicResident Rockstar
Jihwan_Kim well done! Thank you for providing anyref hint