Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Duration.Minutes: How to Extract Minutes

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To get the whole minutes from a duration in Power Query, use Duration.Minutes. It takes a duration value and returns the minute component as a number from 0 to 59. For example, Duration.Minutes(#duration(0,2,35,10)) returns 35. If you need total minutes across hours (like 155 for 2h35m), use Duration.TotalMinutes instead. The function is available in Power Query in Excel, Power BI Desktop, and Power BI Service dataflows, and needs no add-ins or special permissions beyond editing the query.

What You'll Need

  • A Power Query editor open: in Excel, go to Data > Get Data (or From Table/Range), then Transform Data; in Power BI Desktop, use Transform Data on the Home ribbon.
  • A column that contains duration values, or a way to create one (for example by subtracting two datetime columns).
  • Basic familiarity with adding a custom column or editing the formula bar. No coding experience is required.

Step-by-Step

  1. Open the Power Query Editor. In Excel: Data > Get Data > From Other Sources > Blank Query (or From Table/Range if your data is already in a table). In Power BI Desktop: Home > Transform Data. Menu labels can differ slightly by version, device, or region.
  2. Load or create your duration column. If you have start and end datetime columns, select the end column, hold Ctrl, select the start column, then go to Add Column > Subtract (or Date > Subtract Days depending on your version). The result is a duration. If you already have a duration column, skip this step.
  3. Confirm the column type is Duration. Click the type icon in the column header and choose Duration. If the column shows numbers or text, Duration.Minutes will error.
  4. Add a custom column. Go to Add Column > Custom Column. In the dialog, give it a name such as Minutes. In the formula box, type:
    Duration.Minutes([YourDurationColumn])
    Replace YourDurationColumn with the exact column name, including any spaces inside square brackets.
  5. Click OK. Power Query adds the new column. Each row shows the minute portion of the duration, from 0 to 59. A duration of 2:35:10 returns 35; a duration of 0:05:00 returns 5.
  6. Check the data type of the new column. It should be Whole Number. If it is not, click the type icon and set it to Whole Number so it aggregates correctly later.
  7. Rename and reorder if needed. Double-click the new column header to rename it, or drag it to a sensible position. Then use Home > Close & Load (Excel) or Close & Apply (Power BI) to load the result.

Common Mistakes

  • Using Duration.Minutes when you want total minutes. Duration.Minutes returns only the minute component (0–59). For a 2h35m duration it returns 35, not 155. Use Duration.TotalMinutes for the full count.
  • Passing a text or number column. The function expects a duration value. If your column is text like "2:35:10", convert it first with Transform > Duration > Parse, or change the column type to Duration.
  • Forgetting the square brackets. In a custom column, column references must be written as [ColumnName]. Writing ColumnName without brackets causes an error.
  • Assuming it rounds. Duration.Minutes truncates toward the minute component; it does not round seconds up. A duration of 2:35:59 still returns 35.
  • Using it on a date column. Dates and durations are different types. Subtract dates to create a duration first, then apply the function.

Tips

  • Use Duration.Minutes together with Duration.Hours and Duration.Seconds to build a readable "2h 35m" label with Text.From and &.
  • If you need minutes as a decimal (for example 35.17), divide Duration.TotalSeconds by 60 instead.
  • You can call the function directly in the formula bar after selecting a step, which is often faster than opening the Custom Column dialog.
  • For durations longer than 24 hours, Duration.Minutes still returns only the minute part; store total minutes separately if that is what your report needs.
  • Keep a backup of the query before adding columns; you can always duplicate the query with Right-click > Duplicate.

Troubleshooting

If the new column shows Error in every row, the source column is probably not typed as Duration. Select the source column, set its type to Duration, and refresh the custom column step. If only some rows error, those rows likely contain nulls or text that cannot be parsed; filter them out or replace nulls with a zero duration using Transform > Replace Values. If the function name is not recognized, check spelling and capitalization: Power Query is case-sensitive, so duration.minutes will fail. If the result is always 0, confirm you are not passing a date or a number; a number is interpreted as a duration in days, so 1 becomes 1 day and the minutes component is 0. If the column disappears after loading, check that you clicked Close & Load and not Close without applying. Finally, if the editor behaves oddly, close and reopen the query, or restart the host application; labels can vary by version, so look for the equivalent command if a menu item is named differently.

Frequently Asked Questions

What is the difference between Duration.Minutes and Duration.TotalMinutes?

Duration.Minutes returns the minute component from 0 to 59. Duration.TotalMinutes returns the whole duration converted to minutes, so 2 hours 35 minutes returns 155.

Can I use Duration.Minutes on a text column?

No. Convert the text to a Duration type first, for example with the Duration parse option under Transform, then apply the function.

Does Duration.Minutes round seconds?

No. It extracts the minute portion and ignores seconds. A duration of 10 minutes 59 seconds returns 10.

Why does my result show 0 for a one-day duration?

A duration of 1 day has 0 hours and 0 minutes in its minute component. Use Duration.TotalMinutes to get 1440.

Is Duration.Minutes available in Excel and Power BI?

Yes. It is part of the standard Power Query M library used by Excel, Power BI Desktop, and Power BI dataflows, so the same formula works in all of them.

Can I get minutes as a decimal?

Yes. Divide Duration.TotalSeconds by 60, or use Duration.TotalMinutes directly, which already returns a decimal value.