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

How to calculate two different timestamp ?

Hi all,

 

In the following image i would like to calculate the variance of ExaminationEndTime and ExaminationStartTime.

 

the output must be a integer or a whole number in minutes. so for example :

The variance of these two columns on the first row must be 5.

 

Any suggestions?

 

Many thanks,

 

Rega

 

 

2017-08-03 12_58_39-CapacityInsights - Query Editor.png

3 REPLIES 3
Eric_Zhang
Employee
Employee

@Anonymous

You could try 

Capture.PNG

diff mins =
IF (
    HOUR ( 'Table'[ExaminationEndTime] ) <= HOUR ( 'Table'[ExaminationStartTime] ),
    DATEDIFF (
        'Table'[ExaminationStartTime],
        'Table'[ExaminationEndTime] + 1,
        MINUTE
    ),
    DATEDIFF ( 'Table'[ExaminationEndTime], 'Table'[ExaminationStartTime], MINUTE )
)
Anonymous
Not applicable

Hi @Eric_Zhang,

 

Thanks for your input but i got the following message:

 

The start date cannot be greater than the end date...

 

2017-08-04 12_44_18-CapacityInsights - Power BI Desktop.png

Anonymous
Not applicable

Hi @Anonymous,

 

Try to use this calculated column:

 

Column = ([ExaminationEndTime]-[ExaminationStartTime])*24*60 

 // in minutes

 

If not works, try to change the columns to Date/Hour, and check which date you have in both columns.

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.