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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jcastr02
Post Prodigy
Post Prodigy

Custom column based on whats contained in a row

I was trying to create a custom column in power query (a yes/no column is fine)   that if any of the values in the row contains *00:00, the FE Yes/No column would be "No, if not then "Yes"  see below data example and desired result in last column

Location numberFE Sun OpenFE Sun CloseFE Mon OpenFE Mon CloseFE Tue OpenFE Tue CloseFE Wed OpenFE Wed CloseFE Thu OpenFE Thu CloseFE Fri OpenFE Fri CloseFE Sat OpenFE Sat CloseFE Yes/No
2692*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
2761*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
3145*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
31818:0022:007:0022:007:0022:007:0022:007:0022:007:0022:008:0022:00Yes
3400*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
3446*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
36899:0021:007:0021:007:0021:007:0021:007:0021:007:0021:007:0021:00Yes
4212*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
4549*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
4768*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
5192*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
6072*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
6191*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00*00:00No
6564*08:00*22:00*08:00*22:00*08:00*22:00*08:00*22:00*08:00*22:00*08:00*22:00*08:00*22:00Yes
68317:0024:00:007:0024:00:007:0024:00:007:0024:00:007:0024:00:007:0024:00:007:0024:00:00Yes
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @jcastr02 ,

 

Please try:

= Table.AddColumn(#"Changed Type", "Custom", each if List.ContainsAny({Record.Field(_, "FE Sat Open"), Record.Field(_, "FE Sat Close")}, {"*00:00"}) then "Yes" else "No")

 

Best Regards,

Bof

View solution in original post

Create a new step by clicking FX button and then paste that code in Editor, what you're doing is pasting the code in a custom column.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @jcastr02 ,

 

I've made a test for yor reference:

 

if List.ContainsAny(Record.FieldValues(_), {"*00:00"}) then "Yes" else "No"

 

vbofengmsft_0-1731378184922.png

Best Regards,

Bof

Apologies, I should have clarified - what if I Only wanted to check within this table for specific columns, such as FE Sat Open and FE Sat Close (as example) - how could I tailor to list out the specific columns?

Anonymous
Not applicable

Hi @jcastr02 ,

 

Please try:

= Table.AddColumn(#"Changed Type", "Custom", each if List.ContainsAny({Record.Field(_, "FE Sat Open"), Record.Field(_, "FE Sat Close")}, {"*00:00"}) then "Yes" else "No")

 

Best Regards,

Bof

Hello @Anonymous Thanks so much.  I tried to enter this , however getting different answers when the values are the same in the rows.  Any ideas?  Thanks so much.

 

formula.pngCustom Column.png

Create a new step by clicking FX button and then paste that code in Editor, what you're doing is pasting the code in a custom column.

Omid_Motamedise
Super User
Super User

Just copy and past the following code into the Advance editor.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("zZSxDoMwDET/JSNisI1zsfmI7hVi7Nyh/y+VEiK1ZUXgKfENyctFd9OUBC6pTx3RSHTV5vZMc7+wFHAUloE1x2Gxjy9WRZG6luPGv5Pvj1e9V697+s4DVYRhgfky+eYa/3p6/Nj+Q4XDZFWzehiWAovCkjlOn4JKHBb2MN2ODF3lrfe6VnxnKi3UsIG/Iq9jgz1TWWHmNw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Location number" = _t, #"FE Sun Open" = _t, #"FE Sun Close" = _t, #"FE Mon Open" = _t, #"FE Mon Close" = _t, #"FE Tue Open" = _t, #"FE Tue Close" = _t, #"FE Wed Open" = _t, #"FE Wed Close" = _t, #"FE Thu Open" = _t, #"FE Thu Close" = _t, #"FE Fri Open" = _t, #"FE Fri Close" = _t, #"FE Sat Open" = _t, #"FE Sat Close" = _t, #"FE Yes/No" = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Yes/No", each if Text.Contains(Text.Combine(List.Transform(Record.ToList(_),Text.From),"|"),"*00:00") then "No" else "Yes")
in
    #"Added Custom"

 

If this answer helped resolve your issue, please consider marking it as the accepted answer. And if you found my response helpful, I'd appreciate it if you could give me kudos. 

Thank you!

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

Apologies, I should have clarified - what if I Only wanted to check within this table for specific columns, such as FE Sat Open and FE Sat Close (as example) - how could I tailor to list out the specific columns?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.

Top Solution Authors