Forum Discussion

nat365's avatar
nat365
Frequent Visitor
2 years ago
Solved

Creating table with grouped data using DAX

Hi All,

I would like to create table that summarize my data:

NameStatusCode
AnnaY1
AnnaY2
MarkY3
AnnaN4
AnnaY2
MarkY3

 

to following format:

NameCodes
Anna1, 2
Mark3

 

So the task is to create column thats joins distinct values with Status=Y from column Code to one String for each value in column Name.

Do you know is it possible to create using only DAX?

 

 

  • If you want to create a computed table, then use this (replace tbl with your table name)

    SUMMARIZE(CALCULATETABLE(tbl, tbl[Status]="Y"),[Name],"Codes", CONCATENATEX(VALUES(tbl[Code]),[Code], ","))

2 Replies

  • sjoerdvn's avatar
    sjoerdvn
    Solution Sage

    If you want to create a computed table, then use this (replace tbl with your table name)

    SUMMARIZE(CALCULATETABLE(tbl, tbl[Status]="Y"),[Name],"Codes", CONCATENATEX(VALUES(tbl[Code]),[Code], ","))