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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.