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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

How to return multiple values separated by commas (DAX)

Hi, everyone.

I suppose that it is noobie question - but I can't find an answer. Pls, help.

I have 2 tables and need to create a new one

The first table contains Client ID and Source 

The second contains Client ID - and Sold  

New one - Sold Cliend ID + All Souces (separated by commas).

Which function can help with this?

 

The logic is

IF SOURCE.table [Client ID] = SOLD.table [Client ID]

AND SOLD.table [Sold] = yes

RETURN  SOURCE.Sold [Client ID], LIST OF SOURCES (??)

 

Thank you!

 

33.png

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

You can create the following table:

 

Table =
ADDCOLUMNS (
    SUMMARIZE ( FILTER ( Sold; Sold[Sold] = "YES" ); Sold[ClientID] );
    "Source"; CONCATENATEX ( RELATEDTABLE ( Source ); Source[Source]; ", " )
)

 

If you want a measure you should use:

Measure = CONCATENATEX(Source;Source[Source]; ", ")

Then just filter out the Sold to yes on the filter of the visual.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
dmatliak
Frequent Visitor

Hello I have a question related to this topic. I have a table and measure created like this.

dmatliak_0-1632739929158.png

But what I want is to have only 1 value in MCC_LIST. Just filter distinct values, no repetition.

 

Thank you for help, Dusan

HI @dmatliak ,

 

Instead of refering to the all table refer only to the columns you need that will create a summarize with distinct values:

 

MCCList = 
IF (
    HASONEVALUE ( LOC[CUSTID] ),
    VAR mcc_list =
        VALUES ( LOC[CUSTID] )
    RETURN
        CONCATENATEX ( FILTER ( ALL ( LOC[CUSTID], LOC[MCC] ), LOC[CUSTID] IN mcc_list ), LOC[MCC], "," ),
    BLANK ()
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

check this Power Query Solution out.

PBIX

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


MFelix
Super User
Super User

Hi @Anonymous ,

 

You can create the following table:

 

Table =
ADDCOLUMNS (
    SUMMARIZE ( FILTER ( Sold; Sold[Sold] = "YES" ); Sold[ClientID] );
    "Source"; CONCATENATEX ( RELATEDTABLE ( Source ); Source[Source]; ", " )
)

 

If you want a measure you should use:

Measure = CONCATENATEX(Source;Source[Source]; ", ")

Then just filter out the Sold to yes on the filter of the visual.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



amitchandak
Super User
Super User

Join both the tables on client id and use concatenatex on sold.table[source]

 

https://docs.microsoft.com/en-us/dax/concatenatex-function-dax

 

all source =concatenatex(sold.table[source])

 

Display it in a table or matrix along with client id

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Concatenate( First part, Concatenate( ", ", Second part))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors