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
Anonymous
Not applicable

DAX Function to Output Multiple Comma-Separated Values

I have an Ice Cream Order Table with one column being Customer Order Description. An example of a data cell from that column is "The customer ordered a small vanilla ice cream with rainbow sprinkles, chocolate chips, and caramel syrup." I have a new column called Toppings Used where I want to list the toppings that were contained in the string of text from Customer Order Description. For example for the previously mentioned order description have "rainbow sprinkles, chocolate chips, caramel syrup" as a data cell with toppings separated by a comma and a space.

 

Currently I have the DAX function:

Toppings Used = Switch (TRUE(), Containsstring('Ice Cream Order Table'[Customer Order Description], "chocolate chip"), "chocolate chip", Containsstring('Ice Cream Order Table'[Customer Order Description], "fudge"), "fudge sauce", ...)

However, this only gives me one of the toppings. How can I change this code to output multiple values? Thanks in advance.

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Assuming you have another table named 'Toppings' which comprises a single column (named 'Topping') of all possible toppings, this Calculated Column in the Ice Cream Order Table:

 

Toppings Used = 
VAR ThisOrder = 'Ice Cream Order Table'[Customer Order Description]
RETURN
    CONCATENATEX(
        FILTER( Toppings, SEARCH( Toppings[Topping], ThisOrder,, 0 ) ),
        Toppings[Topping],
        ", "
    )

 

Regards

 

View solution in original post

2 REPLIES 2
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Assuming you have another table named 'Toppings' which comprises a single column (named 'Topping') of all possible toppings, this Calculated Column in the Ice Cream Order Table:

 

Toppings Used = 
VAR ThisOrder = 'Ice Cream Order Table'[Customer Order Description]
RETURN
    CONCATENATEX(
        FILTER( Toppings, SEARCH( Toppings[Topping], ThisOrder,, 0 ) ),
        Toppings[Topping],
        ", "
    )

 

Regards

 

Anonymous
Not applicable

This solved my problem, thank you!

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.