cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
lucassescato
New Member

Excel AND function, but, in power query

Hello guys, hope you're good!

 

I have the following formula in excel, and im trying get the same results in power query:

lucassescato_0-1693401978948.png

 

I tried to use the conditional column in Power Query, but it returned "OK" for all the conditions. This happened because if any of the tests returns "OK," it results in "OK" for all the tests. Is there any way to do this using the M language or something similar?

 

 

Thanks in advance and sorry for my bad english hehe

2 ACCEPTED SOLUTIONS
jennratten
Super User
Super User

Hello - you could do it like this:

= Table.AddColumn(#"Changed Type", "Custom", each if List.AllTrue ( { [Column2]="OK",[Column3]="OK",[Column4]="OK",[Column5]="OK",[Column6]="OK" } ) then "OK" else "NOTOK", type text)

 

jennratten_0-1693403436040.png

 

View solution in original post

Vijay_A_Verma
Super User
Super User

Use this in a custom column

if List.Contains(List.Range(Record.ToList(_), 1, 5), "NOTOK") then "NOTOK" else "OK" 

View solution in original post

3 REPLIES 3
lucassescato
New Member

thank you!! it works

Vijay_A_Verma
Super User
Super User

Use this in a custom column

if List.Contains(List.Range(Record.ToList(_), 1, 5), "NOTOK") then "NOTOK" else "OK" 
jennratten
Super User
Super User

Hello - you could do it like this:

= Table.AddColumn(#"Changed Type", "Custom", each if List.AllTrue ( { [Column2]="OK",[Column3]="OK",[Column4]="OK",[Column5]="OK",[Column6]="OK" } ) then "OK" else "NOTOK", type text)

 

jennratten_0-1693403436040.png

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors