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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Power Query - Newbie Question - Comparing Two Columns with Dates

Hello:

 

Power Query newbie here. 

 

I have a Query in Power Query.

 

There is a Column called "Start Date" and there is a column called "T-2" Date.

I would like to compare these two columns. If these two columns match in date, I would like to return a new column that states "Yes."

 

I am having trouble writing this. Something as simple as the below is giving me an error.

if [Start Date] = [T-2 Date] then yes else no

 

 

1 ACCEPTED SOLUTION
Omid_Motamedise
Super User
Super User

if you want to copare row by row, go to add column tab pick custom column tab in the oppened window use the next formula

 

if [Start Date] = [T-2 Date] then "yes" else "no"

but if you want to check the whole table once, use the next formula in a  new step. (imagin your previous step name is Source)

Source[Start Date] = Source[T-2 Date]

If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

2 REPLIES 2
Omid_Motamedise
Super User
Super User

if you want to copare row by row, go to add column tab pick custom column tab in the oppened window use the next formula

 

if [Start Date] = [T-2 Date] then "yes" else "no"

but if you want to check the whole table once, use the next formula in a  new step. (imagin your previous step name is Source)

Source[Start Date] = Source[T-2 Date]

If my answer helped solve your issue, please consider marking it as the accepted solution.
ronrsnfld
Super User
Super User

You need to put strings within quotes, unless you have defined yes and no as variables. 

Also, you "T-2" Date column name looks strange with quotes around the first word and none around the second. So if that is not an error, your syntax is off.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.