Duration.TotalMinutes is a Power Query M function that calculates the total minutes spanned by a duration value. The function returns a decimal number representing the total minutes.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Duration.TotalMinutes( duration as nullable duration ) as nullable number
Description
The Duration.TotalMinutes function calculates the total number of minutes (including fractions) in a duration.
Examples
Let’s see how we can use the Duration.TotalMinutes
function.
Calculating Total Minutes from a Duration Value
The Duration.TotalMinutes
function calculates the total number of minutes from a duration value. For example, a duration of 1 hour and 30 minutes returns 90 minutes:
Duration.TotalMinutes( #duration( 0, 1, 30, 0 ) ) // Output: 90
This is different from the Duration.Minutes function, as that function only retrieves the minutes portion of a duration value after subtracting the day, hours, and seconds portion:
Duration.Minutes( #duration( 0, 1, 30, 0 ) ) // Output: 30
The output of Duration.TotalMinutes
is also correct when the duration value specifies a combination of days, hours, minutes, and seconds. For instance, a duration of 1 day, 1 hour, and 30 minutes returns 1,530 minutes:
Duration.TotalMinutes( #duration( 1, 1, 30, 0 ) ) // Output: 1530
The output is the same when the duration value specifies 1530 minutes directly:
Duration.TotalMinutes( #duration( 0, 0, 1530, 0 ) ) // Output: 1530
By using Duration.TotalMinutes
, you can easily compute the total number of minutes within a duration, regardless of how the duration is composed.
Related functions
Other functions related to Duration.TotalMinutes are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy