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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Invesco
Helper V
Helper V

Count the number of characters in a string Calculated column or Power Query

Hi Experts

 

How would / could you count the number of characters in a string in a column in a table in Power bI

 

Column A                  Result

Apple                       5

Guidelines                10

Oranges                   7

 

2 ACCEPTED SOLUTIONS
v-jayw-msft
Community Support
Community Support

Hi @Invesco ,

 

You could use LEN() function.

https://docs.microsoft.com/en-us/dax/len-function-dax 

If you want to remove space, you could use SUBSTITUTE() function.

https://docs.microsoft.com/en-us/dax/substitute-function-dax 

Column = LEN(SUBSTITUTE('Table'[Column1]," ",""))

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

mahmoud219
New Member

now I have a csv file contain number of chapters in a column like 1,2,3 and every chapter have many cells on it in the next column like chapter 1 verse 1 the question is I need a function returns how many characters I read based on the range I input like I read from chapter 1 to chapter 2 verse 10

(I try to do this function in excel like this =SUM((LEN(SUBSTITUTE(A2:A7," ","")))) I expect to input a range and output number of characters the problem above that I don't know how to make the function take an input for each student

View solution in original post

2 REPLIES 2
mahmoud219
New Member

now I have a csv file contain number of chapters in a column like 1,2,3 and every chapter have many cells on it in the next column like chapter 1 verse 1 the question is I need a function returns how many characters I read based on the range I input like I read from chapter 1 to chapter 2 verse 10

(I try to do this function in excel like this =SUM((LEN(SUBSTITUTE(A2:A7," ","")))) I expect to input a range and output number of characters the problem above that I don't know how to make the function take an input for each student

v-jayw-msft
Community Support
Community Support

Hi @Invesco ,

 

You could use LEN() function.

https://docs.microsoft.com/en-us/dax/len-function-dax 

If you want to remove space, you could use SUBSTITUTE() function.

https://docs.microsoft.com/en-us/dax/substitute-function-dax 

Column = LEN(SUBSTITUTE('Table'[Column1]," ",""))

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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