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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Sudip_J
Helper I
Helper I

I want to create dax function that uses concatenatex in measure or calculated table

Hi Teams,
I want to write concatenates dax function to group subcategory according to their category group .
Here is example -

Sudip_J_0-1747400780299.png



and i want this following output -

Sudip_J_1-1747400837027.png

 
I want this for measures and calculatedtable as well
Thanks & Regards
Sudeep Kumar



 

 

4 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @Sudip_J - create a calculated table with one row per Category and a comma-separated list of Subcategories.

 

CategoryWithSubcategories =
ADDCOLUMNS (
VALUES ( 'YourTable'[Category] ),
"Subcategories",
CONCATENATEX (
FILTER (
'YourTable',
'YourTable'[Category] = EARLIER ( 'YourTable'[Category] )
),
'YourTable'[Subcategory],
", ",
'YourTable'[Subcategory],
ASC
)
)

 

using measure:

Subcategories Measure =
CONCATENATEX (
VALUES ( 'YourTable'[Subcategory] ),
'YourTable'[Subcategory],
", ",
'YourTable'[Subcategory],
ASC
)

 

Hope this works and helps.





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

Proud to be a Super User!





View solution in original post

Alex_Sawdo
Resolver II
Resolver II

You can do this with a DAX measure, here's the code: 

Measure =
CONCATENATEX(
    DISTINCT(
        SELECTCOLUMNS(
            {{YOUR_TABLE}},
            {{YOUR_TABLE}}[Category],
            {{YOUR_TABLE}}[Sub_Category]
        )
    ),
    {{YOUR_TABLE}}[Sub_Category],
    ", "
)

Whenever this measure is present with a Category, it will show all Sub_Categories underneath it in a comma-delimeted list. No need for a seperate calculated table at all.

View solution in original post

Ashish_Excel
Resolver V
Resolver V

Hi,

Write this measure

Measure = CONCATENATEX(VALUES(Data[Sub_Category]),Data[Sub_Category],",")

View solution in original post

v-nmadadi-msft
Community Support
Community Support

Hi @Sudip_J  ,
Thanks for reaching out to the Microsoft fabric community forum.

 I Have you used this Dax measure to create the output you required.

SubCategoryList_Measure = 
CONCATENATEX(
    VALUES('Table'[Sub_Category]),
    'Table'[Sub_Category],
    ", "
)



 This is the screenshot of the output that I got

vnmadadimsft_0-1747627890670.png

 



 Uploading the .pbix file for reference, Please check and let us know if you would like any changes to the output.

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you

View solution in original post

7 REPLIES 7
Sudip_J
Helper I
Helper I

Hi Rajendra,
Thanks for providing the answer .Let me inform you that your dax measure works but for calculated table it is still not working .

 

v-nmadadi-msft
Community Support
Community Support

Hi @Sudip_J 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

 

v-nmadadi-msft
Community Support
Community Support

Hi @Sudip_J  ,
Thanks for reaching out to the Microsoft fabric community forum.

 I Have you used this Dax measure to create the output you required.

SubCategoryList_Measure = 
CONCATENATEX(
    VALUES('Table'[Sub_Category]),
    'Table'[Sub_Category],
    ", "
)



 This is the screenshot of the output that I got

vnmadadimsft_0-1747627890670.png

 



 Uploading the .pbix file for reference, Please check and let us know if you would like any changes to the output.

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you

Ashish_Excel
Resolver V
Resolver V

Hi,

Write this measure

Measure = CONCATENATEX(VALUES(Data[Sub_Category]),Data[Sub_Category],",")

Sudip_J
Helper I
Helper I

Hi Rajendra ,
Thanks for taking the time to respond! I appreciate the input.The solution you provided seems to mismatch
Could you please clarify if I misunderstood something? I attached your answer in the below attached image please go through it .

Sudip_J_0-1747481840569.png

 

Alex_Sawdo
Resolver II
Resolver II

You can do this with a DAX measure, here's the code: 

Measure =
CONCATENATEX(
    DISTINCT(
        SELECTCOLUMNS(
            {{YOUR_TABLE}},
            {{YOUR_TABLE}}[Category],
            {{YOUR_TABLE}}[Sub_Category]
        )
    ),
    {{YOUR_TABLE}}[Sub_Category],
    ", "
)

Whenever this measure is present with a Category, it will show all Sub_Categories underneath it in a comma-delimeted list. No need for a seperate calculated table at all.

rajendraongole1
Super User
Super User

Hi @Sudip_J - create a calculated table with one row per Category and a comma-separated list of Subcategories.

 

CategoryWithSubcategories =
ADDCOLUMNS (
VALUES ( 'YourTable'[Category] ),
"Subcategories",
CONCATENATEX (
FILTER (
'YourTable',
'YourTable'[Category] = EARLIER ( 'YourTable'[Category] )
),
'YourTable'[Subcategory],
", ",
'YourTable'[Subcategory],
ASC
)
)

 

using measure:

Subcategories Measure =
CONCATENATEX (
VALUES ( 'YourTable'[Subcategory] ),
'YourTable'[Subcategory],
", ",
'YourTable'[Subcategory],
ASC
)

 

Hope this works and helps.





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

Proud to be a Super User!





Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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