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
kameshm05
New Member

Power Query for split and sum the values from string

Hi,

I have a requirement to split a string and sum the values. Please find the below string as an example of my requirement. The string is a dynamic string. So we need a solution in as dynamic way.
Example:
2|xxx|3~4|xxx|5~6|xxx|7~8|xxx|9
From my example, our expected answer is 20(2+4+6+8)

I really appreciate any help you can provide.🙄

1 REPLY 1
Vijay_A_Verma
Super User
Super User

In a custom column, put following (replace Data with your column name)

List.Sum(List.Transform(Text.Split([Data],"~"), (x)=>Number.From(Text.BeforeDelimiter(x,"|"))))

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.

Top Solution Authors
Top Kudoed Authors