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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dgwilson
Resolver III
Resolver III

Using DAX Concenate

 

Link to example

 

Here's my source data

NetworkIDStaffActivityHoursAmount
YI12345PhilRKL3300
YI12345JeffRKL4440
YI12345DavidRKL51000
YI12345 KONOTZERO1740
YI12352CindyRKL3300
YI12352BelindaRKL4440
YI12352HelgaRKL51000
YI12352 KONOTZERO1740
YI12388CindyRKL180
YI12388BelindaRKL180
YI12388HelgaRKL180
YI12388BettyRKL180
YI12388 KONOTZERO240

-pasting in here as altered the format of the table slightly. It's OK in the attached / linked zip file.

 

And this is what I want the output to look like

Network IDStaffHoursDollars
YI12345Phil, Jeff, David121740
YI12352Cindy, Belinda, Helga121740
YI12388Cindy, Belinda, Helga, Betty4240

 

And I currently have this DAX (as a new column) that isn't doing the job fo rme.

I've had a go at using CONCENATEX... and I can't get it to work.

 

__Network_ID_Employee_CAT =
VAR networkid = FIRSTNONBLANK(Data[NetworkID],1)
VAR employeesTable = CALCULATETABLE(FIRSTNONBLANK(Data[Staff], 1), FILTER(ALL(Data), AND(Data[NetworkID] = networkid, Data[Activity] = "RKL")))
VAR employeesCAT =
IF(networkid <> BLANK(),
CONCATENATEX(employeesTable, employeesTable, ", "),
"")

RETURN
employeesCAT
1 ACCEPTED SOLUTION

Thank you. Your examples are awesome.

 

I've been able to build the following (based on your examples) and this is working.

 

__Network_ID_Employee_CAT =

VAR networkid = FIRSTNONBLANK(Data[NetworkID],1)

VAR employeesTable = CALCULATETABLE(SUMMARIZE(Data, Data[Staff]), FILTER(ALL(Data), AND(Data[NetworkID] = networkid, Data[Activity] = "RKL")))

VAR employeesCAT =

IF(networkid <> BLANK(),

CONCATENATEX(employeesTable, [Staff], ", "),

"")

 

RETURN

employeesCAT

 

 

View solution in original post

2 REPLIES 2
JarroVGIT
Resident Rockstar
Resident Rockstar

Alright there are two approaches here. You either create a calculated table that has the format of your result, or you create measure and create a table visual with your result.

 

Table visual with your result

I added two measures to the table. Note that we want to concatenate only non-blank values and the same goes for your 'Amount'  column in the desired result: we only want to sum Amount where Staff is not empty.

The first measure shows the concatenated names:

 

ConcatenatedNames = IF(HASONEVALUE(Table2[NetworkID]), CONCATENATEX(FILTER(Table2, Table2[Staff] <> ""), Table2[Staff], ", "))

 

Second measure is the sum of amount (where staff is not empty):

 

AmountMeasure = SUMX(FILTER(Table2, Table2[Staff] <> ""), Table2[Amount])

 

Then I created a table visual, with the NetworkID, the measures and hours column. This is your end result:

image.png

 

Calculated Table with your result

I created some DAX to give you a table with the desired result. The DAX is as follows:

TableConcat = 
VAR startTable = DISTINCT(Table2[NetworkID])
RETURN
ADDCOLUMNS(startTable, 
"Names", 
    VAR ntw = [NetworkID]
    RETURN
        CONCATENATEX(FILTER(ALL(Table2), Table2[Staff] <> "" && Table2[NetworkID] = ntw), Table2[Staff], ","),
        "Hours", 
            VAR ntw = [NetworkID]
            RETURN
            SUMX(FILTER(ALL(Table2), Table2[Staff] <> "" && Table2[NetworkID] = ntw), Table2[Hours]),
            "Amount", 
                VAR ntw = [NetworkID]
                RETURN
                SUMX(FILTER(ALL(Table2), Table2[Staff] <> "" && Table2[NetworkID] = ntw), Table2[Amount]))

The weird thing is that I had to declare the value of the base column in a variable for every column. I don't know why that is, but the above works and results in this table (from data view):

image.png

 

Hope this helps!

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you. Your examples are awesome.

 

I've been able to build the following (based on your examples) and this is working.

 

__Network_ID_Employee_CAT =

VAR networkid = FIRSTNONBLANK(Data[NetworkID],1)

VAR employeesTable = CALCULATETABLE(SUMMARIZE(Data, Data[Staff]), FILTER(ALL(Data), AND(Data[NetworkID] = networkid, Data[Activity] = "RKL")))

VAR employeesCAT =

IF(networkid <> BLANK(),

CONCATENATEX(employeesTable, [Staff], ", "),

"")

 

RETURN

employeesCAT

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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