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
Advocate I
Advocate I

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
Super User
Super 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.

 

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

3 REPLIES 3
nandic
Super User
Super User

@Jihwan_Kim well done! Thank you for providing anyref hint

nyarlathotep
Advocate I
Advocate 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!

Jihwan_Kim
Super User
Super 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.

 

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.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.