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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Unable to compare the dates in power bi it is giving me the wrong value

if ([TestingPhase] = "Interim – Common Process" and [Interim_Status] = "Level 1 Review" and [Level1ReviewDate] > [Level1ReviewDueDate] ) then "Delayed" else "On Track"

 

In the above code I'm getting just the "On Track" in every cells.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

I can get correct result. Could you please share more data?

 

image.png

 

Best Regards,
Winniz

 

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , the formula seems fine. Can share some same with correct and wrong output to check

 

Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

TestingPhaseLevel1ReviewDateInterim_StatusLevel1ReviewDueDateCustom
Interim – Common Process10/07/2021Level 1 Review08/07/2021On Track
Interim – Common Process 10/07/2021Level 1 Review08/07/2021On Track
Walkthrough Level 4 Review08/07/2021null
Anonymous
Not applicable

So basically it is working with single IF and else statement but in my query there are multiple if and else if statements in that case it is not working

 

Query is like this

 

if ([TestingPhase] = "Walkthrough" and [WalkthroughStatus] = "Completed" and [Level4ReviewDate] > [CompletionDueDate] ) then "Delayed"

 

else if ([TestingPhase] = "Interim – Common Process" and [Interim_Status] = "Not Started" and [Actual Start Date] > [Expected Start Date] ) then "Delayed"

 

else "On Track"

Hi @Anonymous ,

 

I can get correct result. Could you please share more data?

 

image.png

 

Best Regards,
Winniz

 

Anonymous
Not applicable

I'm not sure on why it's not working although when I wrote the same piece of code in DAX editor instead of Query editor I got it working

Hi @Anonymous ,

 

If the problem is solved, please mark your reply that will help the other members find it more quickly.

 

If you still have doubts, please provide detailed error information. Let me know immediately, looking forward to your reply.

 

Best Regards,
Winniz

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.