cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ReddyK Frequent Visitor
Frequent Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Calculate percentage for 2 date columns

@ReddyK ,

 

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.

4 REPLIES 4
Aron_Moore Established Member
Established Member

Re: Calculate percentage for 2 date columns

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]))
Community Support Team
Community Support Team

Re: Calculate percentage for 2 date columns

@ReddyK ,

 

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

 

Regards,

Jimmy Tao

ReddyK Frequent Visitor
Frequent Visitor

Re: Calculate percentage for 2 date columns

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
Community Support Team
Community Support Team

Re: Calculate percentage for 2 date columns

@ReddyK ,

 

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.