web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do I change durati...
Power Automate
Unanswered

How do I change duration (minutes) to Duration (text) using power automate select?

(0) ShareShare
ReportReport
Posted on by 14

Hello, I'm relatively new to Power automate so please excuse me if this has already been asked.

 

I'm generating a report from a SharePoint list which contains booking information. What I want to achieve is to automatically swap out the duration values for text. 

My current Setup is this:
Power apps trigger -> Get Items -> Select (pictured below) -> Create CSV Table -> into file (Pictured below)-> into email (finish)

thughes1_0-1710167312346.png 

Which produces the following output : 

thughes1_1-1710167360220.png

What I would like to achieve is for the flow to automatically swap "30" -> "30 Minutes", "60" -> "1 hour" etc etc...

As this is a fantastic product I know this can be achieved somehow, its just that I've not quite learned how to effectively search these forums for specific requests such as this.

 

 

Categories:
I have the same question (0)
  • Andrew_J Profile Picture
    1,962 Moderator on at

    @thughes1 

     

    The way I would do it is to have a number of paralle branches based on the duration and then add a seperate column for duration in text.  Therefore if 30 was entered, this would go down the 30 branch and then add the 30 minutes in the text field.  Once you have the 30 minutes and say 60 minutes working you can then go and add the rest.  However there will be a limit as to how many branches you can have so assuming an 8 hour day in 30 minutes booking interval that would require 16 branches. 

     

    However reading your question above, I am not sure the above logic will help you.  It would be good to understand the full process as I am assuming you are modifing a list initialy but I feel that you do not want an email for every change.

     

    Let me know what you think.

     

    Regards,

     

    Andrew

     

  • Mitanshu Profile Picture
    1,658 Moderator on at

     

    concat(int(div(outputs('Compose'), 60)), ' hours and ', int(mod(outputs('Compose'), 60)), ' minutes') 

     

    You can use above expression to convert your duration into format x hours and y minutes

     

    div(outputs('Compose'), 60) is giving the hour component
    mod(outputs('Compose'), 60) is giving the minute component

     

    You will have to replace outputs('Compose') with your item()?['Duration'] or equivalent

     

    If you don't want 0 hours and to show up for cases where Duration is less than 60, you can always use a condition to check, something like if(outputs('Compose') >= 60

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If this post or my previous reply was useful in other ways, please consider giving it Thumbs Up.

     

     

     

  • TH-27111330-0 Profile Picture
    14 on at

    Hi Both,

     

    Really appreciate the rapid replies from both of you. Andrew I was in the process of getting more information for you just when i saw happy's response so I figured I'd better test that quickly. 

    @happyume  I've given that a go, the formula I used was the following: 

    concat(int(div(item()?['Duration'], 60)), ' hours and ', int(mod(item()?['Duration'], 60)), ' minutes'
    Which returned the following error.
    The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{
    "Title": "@{item()?['Title']}",
    "MeetingStart": "@{formatDateTime(item()?['MeetingStart'],'M/dd/yyyy h:mm tt')}",
    "Duration": "@{concat(int(div(item()?['Duration'], 60)), ' hours and ', int(mod(item()?['Duration'], 60)), ' minutes') }",
    "Room Count": "@{item()?['RoomCount']}",
    "Created By": "@{item()?['Editor']?['Email']}",
    "Cost-Code": "@{item()?['Cost_x002d_Code_x002d_2/Value']}",
    "Room Name": "@{item()?['RoomName']}",
    "Approved By": "@{item()?['Approver']}",
    "Booking ID": "@{item()?['ID']}"
    }' failed: 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.


    Any ideas?

  • TH-27111330-0 Profile Picture
    14 on at

    Just to further on the above, the column where the information is being pulled from is formatted as a number

    thughes1_0-1710173479094.png

     

  • Andrew_J Profile Picture
    1,962 Moderator on at

    @thughes1 

     

    I think the minutes colum in your sp list is a number field and you want it to be in text so that is why I suggested you use the 16 branches to write the text data indvidually into a new time column as text.  Then use the text in the select to output the CSV.

     

    However I could be wrong.

     

    Andrew

  • Andrew_J Profile Picture
    1,962 Moderator on at

    @thughes1 

     

    So you will edit your SP list, then when an item is created or modified, it will be get items then through the paralle branch, 16 number, this would update the number to text values.  These 16 branches would then common up with select in which would would use the text version of the time.  Once the data has been selected then create your CSV file and send.  Flow ends.

     

    Or at least that is what I think you want.

     

    Andrew

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 921

#2
Valantis Profile Picture

Valantis 801

#3
Haque Profile Picture

Haque 588

Last 30 days Overall leaderboard