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
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?

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
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.