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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Natedekock
Regular Visitor

Conditional Formatting with multiple conditions

Hi, 

 

I am looking for help to run this code: 

= Table.AddColumn(#"Removed Columns2", "Custom", each if [#"Who is your Teacher?"] = "Sister Paulette Kirkham" and [Start Date] < 9/16/2020 then "Greg Hazard" else [#"Who is your Teacher?"])

 

The one condition is a text format and the other is date format which is why I believe it is not working. 

 

Looking forward to learning. 

Thanks in advance. 

Nate. 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@Natedekock you have to type dates using the #date() function, so the below should work. You were comparing a date to 9 divided by 16 divided by 2020. It is jus like Excel's DATE() function, but it is #date() and is case sensitive.

= Table.AddColumn(#"Removed Columns2", "Custom", each if [#"Who is your Teacher?"] = "Sister Paulette Kirkham" and [Start Date] < #date(2020,9,16) then "Greg Hazard" else [#"Who is your Teacher?"])

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

@Natedekock you have to type dates using the #date() function, so the below should work. You were comparing a date to 9 divided by 16 divided by 2020. It is jus like Excel's DATE() function, but it is #date() and is case sensitive.

= Table.AddColumn(#"Removed Columns2", "Custom", each if [#"Who is your Teacher?"] = "Sister Paulette Kirkham" and [Start Date] < #date(2020,9,16) then "Greg Hazard" else [#"Who is your Teacher?"])

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Worked like a charm! 

Thank you.

Beautiful @Natedekock - glad I was able to help.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors