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

Calculate percentage for 2 date columns

Hi, 

I am trying to create a measure to see if the job performed is ON Time or Delayed in percentage.

Where Scheduled Job date and Actual job date are 2 columns.

 

Could someone please help me with DAX

1 ACCEPTED SOLUTION

@Anonymous ,

 

You can create a measure using DAX below:

Is Delay = 
VAR Delay_Time = DATEDIFF(MAX('Table'[Scheduled  date]), MAX('Table'[Actual Date]), MINUTE)
RETURN
IF(Delay_Time > 10, "Yes", "No")

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Could you please share some sample data and post the expected result?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

This is the sample data,

It is to calculate difference between scheduled and actual date / total number of loads per carrier in percent. where the allowed delay is 10mins.

 

 

load_numberCustomer_numberCarrier_numberScheduled  dateActual Date
10011ABCPU991/20/2015 18:001/20/2015 0:01
10015ABCFZMT1/20/2015 11:001/21/2015 0:01
10020ABCPU991/20/2015 10:001/20/2015 0:01
10021ABCPU991/21/2015 8:001/20/2015 0:01

@Anonymous ,

 

You can create a measure using DAX below:

Is Delay = 
VAR Delay_Time = DATEDIFF(MAX('Table'[Scheduled  date]), MAX('Table'[Actual Date]), MINUTE)
RETURN
IF(Delay_Time > 10, "Yes", "No")

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Aron_Moore
Solution Specialist
Solution Specialist

You could try something like:

JobSchedule DateActual Date
11/1/20191/1/2019
21/1/20191/1/2019
31/1/20191/1/2019
41/1/20191/2/2019
51/2/20191/2/2019
61/2/20191/2/2019
71/2/20191/3/2019
81/3/20191/3/2019
91/3/20191/3/2019
101/3/20191/4/2019

 

On Time = DIVIDE(CALCULATE(COUNT(Table1[Job]),FILTER(Table1,Table1[Actual Date]=Table1[Schedule Date])),COUNT(Table1[Job]))

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.