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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
vanessafvg
Super User
Super User

iterating over more than one column to check for a value (in m or dax)

I have 13 columns that i need to check to see if there is a "yes" in any of those columns, what is the quickest to do this.

 

I know I can use a switch / if statement in DAX and in M but just putting it out there if anyone has any quicker way to do it?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

If the 13 columns are the only columns, you can add a column in M with formula:

 

= List.Contains(Record.FieldValues(_), "yes")

If, for instance, the 13 columns are the last 13 columns in your table, the formula would look like:

 

 

= List.Contains(List.LastN(Record.FieldValues(_),13), "yes")
Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

If the 13 columns are the only columns, you can add a column in M with formula:

 

= List.Contains(Record.FieldValues(_), "yes")

If, for instance, the 13 columns are the last 13 columns in your table, the formula would look like:

 

 

= List.Contains(List.LastN(Record.FieldValues(_),13), "yes")
Specializing in Power Query Formula Language (M)

ha!  thats perfect thank you





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors