Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
In 'Table' table there is a column [Body Part]. The data comes from user entries, and they are allowed to select multiple entries.
ie Hand, Ankle, Back (the entry form inserts the commas/spaces).
I want to be able to group (or count) each individual body part for use in a visual.
Body Part
Row Hand (r), Hand (l), Shoulder (l)
Ankle (r)
Leg (l), Hand (r)
Hand (l), Neck, Back
Back, Shoulder (r)
In this example, I want to be able to show a count of Hand(4), Ankle (1), Leg(1), Neck(1), Back(2), Shoulder(2).
Not concerned with L or R for this count.
I tried data grouping, but once I put the first entry into a group (for Hand), I cannot use it in another group (for Shoulder), and thus the Shoulder count would be off.
Is there another way? Some kind of measure I could write?
Solved! Go to Solution.
@mwjansen create a new table for body parts and use the following DAX. See attached file for reference:
Body Parts Count =
VAR __Count =
SUMX (
'Table',
VAR __CurrentRow = SUBSTITUTE ( 'Table'[Row], "," , "|" )
VAR __CurrentRowTotalBodyParts = PATHLENGTH ( __CurrentRow )
VAR __CurrentBodyPartsTable =
SELECTCOLUMNS (
ADDCOLUMNS (
GENERATESERIES ( 1, __CurrentRowTotalBodyParts ),
"Current Part", PATHITEM ( __CurrentRow, [Value] )
),
"Current Part", [Current Part]
)
VAR __BodyPartsFound =
FILTER (
CROSSJOIN ( __CurrentBodyPartsTable, 'Body Parts' ),
CONTAINSSTRING ( [Current Part], [Body Part] )
)
RETURN
COUNTROWS ( __BodyPartsFound )
)
RETURN
__Count
Result:
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
hello @v-pgoloju
I followed the pbix/DAX from parry2k, but when i create the same DAX and table in mine, i get an error:
Calculation error in measure 'Body Parts'[Body Parts Count]: The arguments in GenerateSeries function cannot be blank.
That's where I'm stuck.
Hi @mwjansen,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Just following up to see where you're currently facing challenges in implementing the solution. Are you encountering issues with Power Query or DAX? If you've made any progress or tried a different approach, feel free to share it here we’re happy to assist further.
If a solution worked for you, kindly consider marking it as accepted and giving it a thumbs-up to help others in the community benefit as well.
Best regards,
Prasanna Kumar
Hi @mwjansen,
Just a gentle reminder has your issue been resolved? If so, we’d be grateful if you could mark the solution that worked as Accepted Solution, or feel free to share your own if you found a different fix.
This not only closes the loop on your query but also helps others in the community solve similar issues faster.
Thank you for your time and feedback!
Best,
Prasanna Kumar
Hi @mwjansen,
We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.
If the issue is resolved, we’d appreciate it if you could mark the helpful reply as Accepted Solution it helps others who might face a similar issue.
Warm regards,
Prasanna Kumar
Hi @mwjansen,
Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.
If the response addressed your query, kindly mark it as Accepted Solution and click Yes if you found it helpful — this will benefit others in the community as well.
Best regards,
Prasanna Kumar
@mwjansen not sure why, but you should follow what is in the attached pbix file. Not sure what else to tell you.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
In Power Query, split data of that column into rows and remove the information within brackets. Now you should be able to use this measure
Measure = countrows(Data)
Hope this helps.
@mwjansen are you adding it as a column or a measure?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@mwjansen create a new table for body parts and use the following DAX. See attached file for reference:
Body Parts Count =
VAR __Count =
SUMX (
'Table',
VAR __CurrentRow = SUBSTITUTE ( 'Table'[Row], "," , "|" )
VAR __CurrentRowTotalBodyParts = PATHLENGTH ( __CurrentRow )
VAR __CurrentBodyPartsTable =
SELECTCOLUMNS (
ADDCOLUMNS (
GENERATESERIES ( 1, __CurrentRowTotalBodyParts ),
"Current Part", PATHITEM ( __CurrentRow, [Value] )
),
"Current Part", [Current Part]
)
VAR __BodyPartsFound =
FILTER (
CROSSJOIN ( __CurrentBodyPartsTable, 'Body Parts' ),
CONTAINSSTRING ( [Current Part], [Body Part] )
)
RETURN
COUNTROWS ( __BodyPartsFound )
)
RETURN
__Count
Result:
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k I believe I made all the subs in the DAX.
"The expression specified in the query is not a valid table expression"
Body Parts Count =
VAR __Count =
SUMX (
'OR Incident Log',
VAR __CurrentRow = SUBSTITUTE ( 'OR Incident Log'[BODY PART], "," , "|" )
VAR __CurrentRowTotalBodyParts = PATHLENGTH ( __CurrentRow )
VAR __CurrentBodyPartsTable =
SELECTCOLUMNS (
ADDCOLUMNS (
GENERATESERIES ( 1, __CurrentRowTotalBodyParts ),
"Current Part", PATHITEM ( __CurrentRow, [Value] )
),
"Current Part", [Current Part]
)
VAR __BodyPartsFound =
FILTER (
CROSSJOIN ( __CurrentBodyPartsTable, 'Anatomy' ),
CONTAINSSTRING ( [Current Part], [Body Part] )
)
RETURN
COUNTROWS ( __BodyPartsFound )
)
RETURN
__Count
"Current Part" is highlighted red
@mwjansen how many approx. rows you have in the transaction tables?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k 645 rows.
Also, I want to exclude the (r) and (l) identifiers in the cells.
@mwjansen you need to create a table with all the body parts that you want to count. once that table is available, you can iterate thru each row value of that table and check with transaction table to get the count.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I think I understand what you've written, but have no idea how to get started.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
66 | |
64 | |
52 | |
39 | |
25 |
User | Count |
---|---|
80 | |
57 | |
45 | |
44 | |
35 |