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
IanDavies
Helper I
Helper I

Replacing text

I have some exported data that is imported to PowerQuery as a TAB separated file and one of the columns has the data in this format:

 

{'Group_tags': ['GMGB'], 'Host_tags': []}

 

I'd like to be able to extract just the TAG (GMGB) without any of the surrounding key names or punctuation. A simple text replace doesn't work, I assume because there are special or control characters in the text.

There is only ever one TAG and always in Group_tags

 

Is there a way to get to the desired output?

Ian

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@IanDavies So you want the GMGB? You could use split column potentially. You could also use RegEx expressions in an R or Python script step.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
IanDavies
Helper I
Helper I

Split Column worked for my purposes. I did two splits, the first one on one position and the second one on the lefy most occurence of a delimiter.

 

It feels like a fudge but gives me what I need.

UPDATE:

 

I was able to do this by splitting on the apostrophes and removing all unwanted columns

Greg_Deckler
Super User
Super User

@IanDavies So you want the GMGB? You could use split column potentially. You could also use RegEx expressions in an R or Python script step.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

AFAIK I cant use DAX. The recipients of the final output will only have Excel hence the question in a Power Query forum.

 

Not familiar with R ... could do python but not sure I want to (REGEX yuck). I will research how to do this. If you've got pointers to get me started I'd appreciate it.

 

I'll try the split column route and see what happens

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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