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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
MarcioLeal89
Advocate I
Advocate I

Does ID starts with any value from list from column in the same table

Hi all,

 

I need to verify if each row on column "ID" starts with any value from a list from the column "ID starts with" in the same table.

 

This list will be different for each "Group ID".

 

I am trying the following but gives an error (Expression.Error: We cannot convert a value of type List to type Text.)

List.AnyTrue( List.Transform({Text.SplitAny([ID Starts With], ",")}, (substring) => Text.Contains([ID], substring)))

 

I have to do this on the Power Query editor.

Example:

 

"Group ID"      "ID"                      "ID Starts with"         "Result expected"

A                     TRP123                TRP, PT                          Yes

A                     RUN123               TRP, PT                          No

B                      OL123                 RUN                              No

C                      PT123                 TR, RUN                        No

C                      TR123                 TR, RUN                        Yes

D                     ABC123               ABC , RUN, PT, TR        Yes

 

Appreciated for your help.

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

NewStep=Table.AddColumn(PreviousStepName,"Result Expected",each List.Contains(Text.Split([ID Starts with],","),[ID],(x,y)=>Text.StartsWith(y,x)))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

NewStep=Table.AddColumn(PreviousStepName,"Result Expected",each List.Contains(Text.Split([ID Starts with],","),[ID],(x,y)=>Text.StartsWith(y,x)))

Anonymous
Not applicable

This approach worked for me too, thanks for posting.

 

Can you explain the last part of the step? The "[ID],(x,y)=>Text.StartsWith(y,x)))" part? I've never seen the => in a step, and i dont understand why the x,y before the => switches to y,x (flips order). I assume the x, y are variables?

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.