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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
timward10
Helper II
Helper II

Return multiple values

Hi, 

 

I have two tables that I am using from Salesforce objects. 

 

Table 1 = Opportunties

Table 2 = Opportuntiy products

 

Table 1 is all of the opportunties available, and Table 2 shows any products that are against the opportunties. 

 

Table two can contain more than one product per opportunity, for example 

 

Opportunity ID - 12345 - Product A

Opportunity ID - 12345 - Product B 

Opportunity ID - 12345 - Product C

 

And so on. 

 

There will also be opportunities that have no products, that I still want to display. 

 

Each table has got an Opportunity ID, so a unique identifier between the two, and I have added a relationship here. 

 

How do I return the multiple values from Table 2 into Table 1? As Table one is the master opportunity owner. 

 

Its my first time using objects, as Salesforce report imports are limited to 2k rows (which has meant I can't just pull the data through from the report due to the restrictions) so having to use objects as a work around. 

 

Any help is appreciated. 

 

Thanks

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @timward10,

 

Can you please try this approach to display all products as a single concatenated string:

OpportunityProductsList = 
VAR Products = 
    CONCATENATEX(
        RELATEDTABLE('Opportunity Products'),
        'Opportunity Products'[Product Name],
        ", " -- Separator
    )
RETURN 
    IF(ISBLANK(Products), "No Products", Products)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Anonymous
Not applicable

Hi ,

Based on the information, try using the following DAX formula to split products column across three lines or using power query editor to transform the column.

OpportunityProductsExpanded =
   GENERATE(
    Opportunities,
    IF(
     COUNTROWS( RELATEDTABLE('Opportunity Products') ) > 0,
      SELECTCOLUMNS(
       RELATEDTABLE('Opportunity Products'),
       "OpportunityID", [Opportunity ID],
       "Product", [Product Name]
      ),
     ROW("OpportunityID", Opportunities[Opportunity ID], "Product", "No Products")
    )
   )

GENERATE 函数(DAX) - DAX | Microsoft Learn

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Sahir_Maharaj
Super User
Super User

Hello @timward10,

 

Can you please try this approach to display all products as a single concatenated string:

OpportunityProductsList = 
VAR Products = 
    CONCATENATEX(
        RELATEDTABLE('Opportunity Products'),
        'Opportunity Products'[Product Name],
        ", " -- Separator
    )
RETURN 
    IF(ISBLANK(Products), "No Products", Products)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi @Sahir_Maharaj

 

Thank you, that formula works great! 

 

Is there a way I can split that out? 

 

For example, one opportuntiy that has three products all shows on one line. Could I split that out across three lines? So instead of the oppotunity count being one it would be three? 

 

Thanks again! 

Anonymous
Not applicable

Hi ,

Based on the information, try using the following DAX formula to split products column across three lines or using power query editor to transform the column.

OpportunityProductsExpanded =
   GENERATE(
    Opportunities,
    IF(
     COUNTROWS( RELATEDTABLE('Opportunity Products') ) > 0,
      SELECTCOLUMNS(
       RELATEDTABLE('Opportunity Products'),
       "OpportunityID", [Opportunity ID],
       "Product", [Product Name]
      ),
     ROW("OpportunityID", Opportunities[Opportunity ID], "Product", "No Products")
    )
   )

GENERATE 函数(DAX) - DAX | Microsoft Learn

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors