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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
WinterMist
Impactful Individual
Impactful Individual

DAX Comma Separated Product Values Within Table Visual

Hello Community - 

 

The test PBIX is located here:

https://drive.google.com/file/d/1FoKbRlzzW378owG71w_qwDVfkxCwLP9x/view?usp=sharing

 

 

The following table visual exists, with 4 rows for 2023.

 

WinterMist_0-1698180056712.png

 

The desired outcome is to add a comma-separated list of Products to this 4 row table, as follows:

 

WinterMist_1-1698180190276.png

 

However, currently when I add Product to the visual, it adds a row for every Product, and resulting in "Count Policies" measure always equalling 1.  (Although this is correct, it is not what business wants.)

 

WinterMist_3-1698180302058.png

 

Thanks in advance for the help.

Nathan

 

 

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

Try this:

 

 

List of Product Names = 
CALCULATE(  CONCATENATEX( filter( all('Product'), 'Product'[ProductKey] in VALUES('Fact Sales'[ProductKey])), 'Product'[Product Name], ", ", 'Product'[Product Name], asc)) 

 

sevenhills_0-1698201480620.png

 

 

View solution in original post

4 REPLIES 4
WinterMist
Impactful Individual
Impactful Individual

@sevenhills 

 

Thank you.  This is excellent!  

I will definitely mark this as a solution.

However, just had a question first.

 

I created a second measure  [02 Product List] and noticed that it returns the same desired results.  The only difference is that the CALCULATE is removed.  So from the results, it appears that the CALCULATE makes no difference.  Am I wrong about this?  Is there a recommended reason for leaving CALCULATE in the measure?

 

WinterMist_0-1698241146770.png

 

Regards,

Nathan

You are right that we don't need CALCULATE. Good catch!

 

Typically, I do this of more habit. 

CALCULATE(Sum(Table1[Column2Calc]), Filter ( all (Table1), Table1[Column1] = .... ) 

 

So started with this, which works and later changed and pasted.

CALCULATE(  

    CONCATENATEX('Product', 'Product'[Product Name], ", ", 'Product'[Product Name], asc)
    , filter( all('Product'), 'Product'[ProductKey] in VALUES('Fact Sales'[ProductKey]))
    )
 
Regards

 

ThxAlot
Super User
Super User

Concat = 
CONCATENATEX(
    CALCULATETABLE( VALUES( 'Product'[Product Name] ), 'Fact Sales' ),
    'Product'[Product Name],
    ", "
)

ThxAlot_0-1698225712869.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



sevenhills
Super User
Super User

Try this:

 

 

List of Product Names = 
CALCULATE(  CONCATENATEX( filter( all('Product'), 'Product'[ProductKey] in VALUES('Fact Sales'[ProductKey])), 'Product'[Product Name], ", ", 'Product'[Product Name], asc)) 

 

sevenhills_0-1698201480620.png

 

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors