web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to concatenate values from multiple rows

(0) ShareShare
ReportReport
Posted on by 55

Hello Experts

I'm working with report. I have a situation similar to classic

ID - EXTID - VALUE

1 - 1 - Val1

2 - 1 - Val2

I need to concatenate values

( Final result : 1 - Val1, Val2 )

using SQL 2 CDS tool (then I will traslate it in FetchXML);

I tried WITH CTE, FOR XML PATH, with no luck

How can I complete this task?

Thanks

I have the same question (0)
  • Verified answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    Thank you for your query.

    In SQL Server you can use STRING_AGG() for this purpose.

    For example:

    SELECT [IDColumn], STRING_AGG([ValueColumn], ',') [ContactVal]
    
    FROM Table1
    
    GROUP BY [IDColumn]

    However, as far as I know, this will not work in SQL 4 CDS (it does not support STRING_AGG).

    Also, the fetch xml has limited aggregation options (Sum, Count, Avg etc.):

    Use FetchXML aggregation (Microsoft Dataverse) - Power Apps | Microsoft Docs

    I guess, your only option is to user grouping in SSRS report (not in the query) or use Join operation in SSRS expressions to concatenate values form rows:

    reporting services - How to convert multiple rows into one row in SSRS? - Stack Overflow

    SSRS concatenate field in one string delimited by comma - without SQL (microsoft.com)

  • Suggested answer
    Carlik Profile Picture
    55 on at

    Your last link was helpful!

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 182 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans