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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
danishwahab
Helper I
Helper I

Xlookup from string

Dear All,

 

We are getting data in the below format where we are getting Raw value against each point and we need to identify it's state based on the metata in the State column coming in as a string value.

 

danishwahab_0-1727679400170.png

 

 

E.g. Point ID 1 should have occupancy state as Unoccupied where as Point ID 2 should have occupancy state as Occupied.

 

Expected Values

danishwahab_1-1727679415581.png

 

We are dealing with huge timeseries sensors data coming in every 15 minutes. Kindly provide us the logic DAX or Custom column logic which should have minimum performance impact. Also please suggest is this too bad to implement this in Power BI?

 

Thanks!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you uzuntasgokberk 

Hi, @danishwahab 

You can do this in Power Query in Power BI. Here are the detailed steps:

First I have the following dataset:

vjianpengmsft_0-1727755304956.png

To open the Advanced Editor:

vjianpengmsft_1-1727755339448.png

Copy the following M code into the Advanced Editor:

ExtractText = Table.AddColumn(#"Changed Type", "Extracted Text", each Text.BetweenDelimiters(_[State],Text.From( _[Raw Data Value]) & "=",";"))

vjianpengmsft_2-1727755423678.png

The results are as follows:

vjianpengmsft_3-1727755457539.png

I have uploaded the PBIX file I used for this post below.

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Thank you uzuntasgokberk 

Hi, @danishwahab 

You can do this in Power Query in Power BI. Here are the detailed steps:

First I have the following dataset:

vjianpengmsft_0-1727755304956.png

To open the Advanced Editor:

vjianpengmsft_1-1727755339448.png

Copy the following M code into the Advanced Editor:

ExtractText = Table.AddColumn(#"Changed Type", "Extracted Text", each Text.BetweenDelimiters(_[State],Text.From( _[Raw Data Value]) & "=",";"))

vjianpengmsft_2-1727755423678.png

The results are as follows:

vjianpengmsft_3-1727755457539.png

I have uploaded the PBIX file I used for this post below.

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @Anonymous ,

 

This worked perfectly as expected. Thanks for all your efforts and help in this. 

 

Thanks!

uzuntasgokberk
Super User
Super User

Hello @danishwahab,

 

That would be better make a relationship Instead of writing a dax code f the perfomance better for you.

 

Best Regards,
Gökberk Uzuntaş

LinkedIn: https://www.linkedin.com/in/g%C3%B6kberk-uzunta%C5%9F-b43906198/

Medium: https://medium.com/@uzuntasgokberk

 

İf this post helps, then please consider Accept it as solution and kudos to help the other members find it more quickly.

 

Thanks @uzuntasgokberk  for your response.
For this how can we convert this to a table as the metadata is in string format with multiple values in a single column. As per my understanding we have to create a separate table status value in each row against each Point ID.

Hello @danishwahab,

You can use Power Query(Transform Data), you can duplicate the fact table or referance and select columns that neccesary and remove duplicates. Make sure your created table has unique rows. Close & Apply and make relationship 1 to Many.

Best Regards,
Gökberk Uzuntaş

LinkedIn: https://www.linkedin.com/in/g%C3%B6kberk-uzunta%C5%9F-b43906198/

Medium: https://medium.com/@uzuntasgokberk

 

İf this post helps, then please consider Accept it as solution and kudos to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.