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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BenGWeeks
Regular Visitor

Custom Column Query

I would like to create a column that counts the number of items in a comma separated striong as follows:

 

BenGWeeks_0-1632401924502.png


However, the ProjectCount column is currently returning errors (and needs an IF statement added if the project string has no commas the count should be 1).

 

BenGWeeks_1-1632402058169.png

 

This then splits the cost based on how many projects for each row. I shall then be splitting/pivoting the table on the projects.

 

Any help much appreciated.

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @BenGWeeks ,

 

Try using this calculation instead:

 

if [Projects] = null then 0 else List.Count(List.PositionOf(Text.ToList([Projects]), ",", Occurrence.All)) + 1

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @BenGWeeks ,

 

Try using this calculation instead:

 

if [Projects] = null then 0 else List.Count(List.PositionOf(Text.ToList([Projects]), ",", Occurrence.All)) + 1

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




amitchandak
Super User
Super User

@BenGWeeks , This power query code used in DAX new column. Please open data transformation and try it there.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors