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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Compare dates and calculate %

Hi, 

I need to compare two dates (completion date & target date) and calculate a % of items that were completed within the set target date. 

My data looks like below : 

Item #Completion dateTarget Date
115/08/202020/08/2020
217/08/202015/08/2020
320/08/202020/08/2020
423/08/202020/08/2020

The data type for both the date columns is set to date. 

If the completion date is less than or equal to the target date, then display Met else Not met. Then calculate a % of the total items that met the SLA. 

To compare the two dates and return a value in a calculated column, I am using the 'IF' function, however, I get the following error

SLA = If(TestWorkFlow[ActualCompletionDate]< TestWorkFlow[TargetDate],"Met", "Not met")
 SLA.jpg

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , check data type of both columns it should be date and datetime

Also this should be column

SLA = If(TestWorkFlow[ActualCompletionDate]< TestWorkFlow[TargetDate],"Met", "Not met")

 

Also check for date form dd/mm/yyyy

https://community.powerbi.com/t5/Desktop/How-to-apply-UK-date-format-dd-mm-yyyy-in-Date-slicer/td-p/599712

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , check data type of both columns it should be date and datetime

Also this should be column

SLA = If(TestWorkFlow[ActualCompletionDate]< TestWorkFlow[TargetDate],"Met", "Not met")

 

Also check for date form dd/mm/yyyy

https://community.powerbi.com/t5/Desktop/How-to-apply-UK-date-format-dd-mm-yyyy-in-Date-slicer/td-p/599712

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

 @amitchandak  Thanks. It worked. I didn't check the field/data type for one of the dates that's what was causing the error.

Greg_Deckler
Community Champion
Community Champion

@Anonymous - I think you want something like Open Tickets - https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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