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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
asamr
Helper I
Helper I

TextSplit

Hi,

 

I have this string where I have succesfully grabed, adults, children and infants.

 

asamr_0-1659619043500.png

 

This has been done by this formula by a fellow community member:

 

List.Sum(List.Transform(List.Skip(Text.Split([metadata],"adults"":")),
(t)=> try Expression.Evaluate(Text.BeforeDelimiter(t,",") ) otherwise Number.From(Splitter.SplitTextByCharacterTransition({"0".."9"},{",","}"})(t){0},"en-US")))

 

I have tried tweaking the formula so I can grab market_code (the last 3 lines)

 

List.Sum(List.Transform(List.Skip(Text.Split([metadata],"market_code"":")),
(t)=> try Expression.Evaluate(Text.BeforeDelimiter(t,",") ) otherwise Number.From(Splitter.SplitTextByCharacterTransition({"0".."9"},{",","}"})(t){0},"en-US")))

 

The formula is returning an error and I have tried a lot of tweaking.

 

Anybody able to help me? 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

You can use following formula for everything here. Just replace "market_code by say adults etc.

= try Text.Split(List.RemoveNulls(List.Transform(Text.Split(Text.Remove([metadata],""""),","),(x)=>if Text.Contains(x,"market_code") then x else null)){0},":"){1} otherwise null

 

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

You can use following formula for everything here. Just replace "market_code by say adults etc.

= try Text.Split(List.RemoveNulls(List.Transform(Text.Split(Text.Remove([metadata],""""),","),(x)=>if Text.Contains(x,"market_code") then x else null)){0},":"){1} otherwise null

 

Thank you so much Vijay for your fast response - This is awesome! 🙂

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.