This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
I want to split text by number of characters but if at that certain position the word is not complete then take it to the end of the word.
| Text | Split by Number of Characters 25 | Increase number of characters to 26 to complete the word | Next 25 Characters to start at position 27 and go up by 24 to complete the next word before splitting |
| The United Nations General Assembly proclaimed 24 January as International Day of Education, in celebration of the role of education for peace and development. The right to education is enshrined in article 26 of the Universal Declaration of Human Ri | The United Nations Genera | The United Nations General | Assembly proclaimed 24 |
Solved! Go to Solution.
Add a new column
Splitter.SplitTextByPositions(
Table.Group(
Table.FromColumns({{0}&Text.PositionOf([Text]," ",Occurrence.All)},{"Position"}),
{"Position"},
{},
GroupKind.Local,
(x,y)=>if y[Position]>(x[Position]+25) then 1 else 0)
[Position])
([Text])
Stéphane
Add a new column
Splitter.SplitTextByPositions(
Table.Group(
Table.FromColumns({{0}&Text.PositionOf([Text]," ",Occurrence.All)},{"Position"}),
{"Position"},
{},
GroupKind.Local,
(x,y)=>if y[Position]>(x[Position]+25) then 1 else 0)
[Position])
([Text])
Stéphane
Hi Stephane
Note: in above 25 is replaced with 250. I am trying to build a Twitter auto post generator which is limited by 280 characters in due to character limit of Twitter.
The above custom column produces a list. When I expand it to rows and look at the lenght of the text in some cases it goes over 250. is it possible to limit it to 250 or less
Stephane, Thanks a million times,
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.