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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Tim01425
Frequent Visitor

power bi count MAX the number of times a character appears in a row

I want to calculate the max a special character appears in a row. As per teh example below, row 5 has the maximun "\" in the column. I would like to produce similar resaults using DAX. 

 

I tired the following but it's not working: Max character= CALCULATE(max('table'[Path]),SEARCH("\";'table'[Path];;0)) 

 

I am unable to write required dax to fulfill these conditions. Can someone please help ? Thank you for your valuable help.

 

Tim01425_1-1669704070018.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

try to create a measure with the code below:

MaxPathCount =
MAXX(
    TableName,
    LEN(TableName[Path])  - LEN( SUBSTITUTE(TableName[Path], "\","") )
)
 
i tried with simplified data and it worked as below
FreemanZ_0-1669706778415.png
FreemanZ_1-1669706801042.png

 

 

View solution in original post

2 REPLIES 2
Tim01425
Frequent Visitor

Thank you FreemanZ... this is exactly what I needed.

 very much appreciated

FreemanZ
Super User
Super User

try to create a measure with the code below:

MaxPathCount =
MAXX(
    TableName,
    LEN(TableName[Path])  - LEN( SUBSTITUTE(TableName[Path], "\","") )
)
 
i tried with simplified data and it worked as below
FreemanZ_0-1669706778415.png
FreemanZ_1-1669706801042.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors