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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors