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
ohb60
Frequent Visitor

Number of expressions (text or number) per row

Hello

 

I would like to count the number of expressions per row, whatever the method.

Could you help me please ? 

 

Example : 

row1 => the apple is green => number of expressions = 4

row2 = 1 chair in the office => number of expressions = 5

 

O.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

You can try with this:

 

Number of Expressions= LEN(Table[Field])-LEN(SUBSTITUTE(Table[Field];" ";""))+1

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

You can try with this:

 

Number of Expressions= LEN(Table[Field])-LEN(SUBSTITUTE(Table[Field];" ";""))+1

ks a lot Chiara it works perfectly !

Anonymous
Not applicable

As per my knowledge, there is no direct way to count string, easier is to write a stored procedure and read it from there.

 

BEGIN
FOR i IN 1..Length(str) LOOP
p := Substr(str, i, 1);
IF p = ' ' THEN
noofwords := noofwords + 1;
END IF;
END LOOP;

 

 

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.