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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
su1337
Regular Visitor

DAX Script for TOTAL and CONCAT

 

1. I need a TOTAL column that will sum the number of 'Runs' for each 'Group'. --> TOTAL for group A would be 5

 

2. I need to combine like terms in the 'Type' column if the 'Group' and 'Project' are identical. --> So Group A would be listed as

 

ABlueWeb, Mobile5

 

 

 

 

Group Project Type Runs --> these are the column headers
ABlueWeb2
ABlueMobile3
BOrangeMobile1
CRedWeb4
CRedWeb3
CPinkWeb1
DYellowMobile2
6 REPLIES 6
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @su1337,

 

Alternatively, you can new a calculated table.

Table5 =
SUMMARIZE (
    table4,
    table4[Group],
    table4[Project],
    "Type", CONCATENATEX ( table4, table4[Type], "," ),
    "Runs", SUM ( table4[Runs] )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ChrisMendoza
Resident Rockstar
Resident Rockstar

@su1337,

 

If you are able to let the visual do some of the work for you, you can try the following as a measure:

 

Measure = 
IF(
    HASONEFILTER(TableName[Group]),
    CONCATENATEX(TableName,TableName[Type],", ",TableName[Type],ASC)
)

This will produce a visual Matrix or Table respectively as;

 

4.PNG






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



The problem is that I need this script to run against the selected visual filters. I have the entire data filtered by date and other parameters so the script needs to take that into account.

 

I wasnt sure if there was a way to save a visual as a table because that could help the problem I am experiencing. 

Hi @su1337,

 

That case, you can try ChrisMendoza's suggestion to create a measure which would return result conditionally taking slicer selection into account.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

No this didn't work, unfortunately. 

Hi @su1337,

 

Would you please share your sample .pbix file to make your scenario more clear?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.