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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
karinab18
New Member

add concatenated column to summarize table

HI, I am trying to biuld a table for reporting out summarized data used by finance.  My data samples are below along with the current SUMMARIZE function I am using.  The part I am stuck on is concatenating all teh relevent serial # field eseparated by space or other delimiter in a column in the final table.

 

I have looked at Add columns, but not seen how to create a column with just the values I want, not sure if the summarize function would be the filter to get these.

 

The code I have posted gets everything except the serial # column.

Sale Summary = SUMMARIZE(SalesReport,SalesReport[DATE].[MonthNo],SalesReport[Name],SalesReport[ITEM], SalesReport[AMOUNT],"QTY", calculate(countaxSalesReport,SalesReport[ITEM]),SalesReport[TYPE]="Pending"),"Total",Calculate(Sum(SalesReport[Amount]),SalesReport[TYPE]="Pending"))

 

* The Pending filter is used bacause my data has other values, I only included a small set of the data as sample here.

 

Appreciate any help on this.

 

Raw data Table: SalesReport

        
DATENameTYPEITEMSerial #Amount QTY
1/25/2017Cust 1PendingPlan 1CU123455652801 
1/25/2017Cust 1PendingPlan 1CU123455662801 
1/25/2017Cust 1PendingPlan 1CU123454572801 
1/26/2017Cust 1PendingPlan 2CU123455672901 
1/25/2017Cust 1PendingPlan 1CU123454472801 
1/26/2017Cust 1PendingPlan 2CU123445672901 
2/1/2017Cust 1PendingPlan 2CU123455682901 
2/3/2017Cust 1PendingPlan 3CU123455693001 
1/25/2017Cust 2PendingPlan 2CU123458702501 
1/25/2017Cust 2PendingPlan 2CU123458712501 
1/26/2017Cust 2PendingPlan 3CU123454602601 
1/25/2017Cust 2PendingPlan 2CU123458752501 
1/25/2017Cust 2PendingPlan 2CU123458762501 
1/26/2017Cust 2PendingPlan 3CU123454902601 
2/1/2017Cust 2PendingPlan 3CU123454612601 
2/3/2017Cust 2PendingPlan 1CU123454622401 
1/25/2017Cust 3PendingPlan 1CU123459632301 
1/25/2017Cust 3PendingPlan 2CU123459642401 
1/26/2017Cust 3PendingPlan 3CU123454652601 
1/25/2017Cust 3PendingPlan 1CU123459672301 
1/25/2017Cust 3PendingPlan 2CU123459682401 
1/26/2017Cust 3PendingPlan 3CU123459692601 
1/25/2017Cust 3PendingPlan 1CU123459972301 
1/25/2017Cust 3PendingPlan 2CU123459982401 
1/26/2017Cust 3PendingPlan 3CU123459992601 
2/1/2017Cust 3PendingPlan 3CU123453662601 
2/3/2017Cust 3PendingPlan 3CU123453672601 
        

 

 

Output Data in Matrix report:

   Month No     
   1  2  
NameITEMAmountQTYTotalSerial #QTYTotalSerial #
         
Cust 1Plan 1$2804$1,120CU12345565 CU12345566 CU12345457 CU123454470$0 
 Plan 2$2902$290CU12345457 CU123455671$290CU12345568
 Plan 3$3000$0 1$300CU12345569
Cust 2Plan 1$2400$0 1$240CU12345461
 Plan 2$2504$1,000CU12345870 CU12345871 CU12345875 CU123458760$0 
 Plan 3$2602$520CU12345460 CU123454901$260CU12345462
Cust 3Plan 1$2303$690CU12345963 CU12345967 CU123459970$0 
 Plan 2$2403$720CU12345964 CU12345968 CU123459980$0 
 Plan 3$2603$780CU12345465 CU12345969 CU123459992$520CU12345366 CU12345367
1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

You don't really new a New Table - you can do this in a Matrix with 1 MEASURE

 

Serials MEASURE =
IF (
    HASONEVALUE ( SalesReport[ITEM] ),
    CONCATENATEX (
        SalesReport,
        SalesReport[Serial #],
        " ",
        SalesReport[Serial #], ASC
    )
)

Here's the result Smiley Happy

 

SUMMARIZE or MATRIX.png

Hope this helps! Smiley Happy

View solution in original post

4 REPLIES 4
Sean
Community Champion
Community Champion

You don't really new a New Table - you can do this in a Matrix with 1 MEASURE

 

Serials MEASURE =
IF (
    HASONEVALUE ( SalesReport[ITEM] ),
    CONCATENATEX (
        SalesReport,
        SalesReport[Serial #],
        " ",
        SalesReport[Serial #], ASC
    )
)

Here's the result Smiley Happy

 

SUMMARIZE or MATRIX.png

Hope this helps! Smiley Happy

Thank you, I added the measure to my table and was able to summarize the data correctly.  Really appreciate the help here.

Sean
Community Champion
Community Champion

If you decide to go with a NEW TABLE you'll need to add couple extra lines like this... for the Year and Month

 

New Table =
SUMMARIZECOLUMNS (
    'SalesReport'[DATE].[Year],
    'SalesReport'[DATE].[Month],
    'SalesReport'[Name],
    'SalesReport'[ITEM],
    "Amount", MIN ( 'SalesReport'[Amount] ),
    "QTY", CALCULATE ( SUM ( SalesReport[ QTY] ) ),
    "Serial #", CONCATENATEX ( 'SalesReport', 'SalesReport'[Serial #] & " " ),
    "Total", MIN ( 'SalesReport'[Amount] ) * CALCULATE ( SUM ( 'SalesReport'[ QTY] ) )
)

Here's this result...

SUMMARIZE or MATRIX2.png

 

Hope this helps! Smiley Happy

Phil_Seamark
Employee
Employee

How about something along the lines of this?  I used your RawData and named the table Raw DAta

 

New Table = SUMMARIZECOLUMNS(
        'RawData'[Name] , 
        RawData[ITEM] , 
        "Amount" , MIN('RawData'[Amount]) ,
        "QTY" , CALCULATE(SUM('RawData'[ QTY])) ,
        "Serial #" , CONCATENATEX('RawData','RawData'[Serial #] & " ") ,
        "Total" , MIN('RawData'[Amount]) * CALCULATE(SUM('RawData'[ QTY]))
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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