Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nyarlathotep
New Contributor III

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)

1 ACCEPTED SOLUTION
Jihwan_Kim
Esteemed Contributor III

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.

 

Jihwan_Kim_0-1758477765761.png

 

Jihwan_Kim_1-1758477854467.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Esteemed Contributor III

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.

 

Jihwan_Kim_0-1758477765761.png

 

Jihwan_Kim_1-1758477854467.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
nyarlathotep
New Contributor III

@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!

Helpful resources

Announcements
Users online (8,084)