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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Make float variable value to be displayed in hours and minutes // Power Automate

(0) ShareShare
ReportReport
Posted on by 13

Hi everyone!

I'm creating a flowchart in Power Automate which will populate a planner task
I want my float value to be converted to hours and minutes
For an example i would like to make my float value which is 25.86 be displayed as 25h 51m

i've tried couple of codes but im getting an error message that the expression is invalid


1.int(variables('Result')) & 'h ' & int((variables('Result')-int(variables('Result')))*60) & 'm'
2.concat(int(variables('Result')), 'h ', int((variables('Result')-int(variables('Result')))*60), 'm'


Does anyone have an idea on what else could i try?

Thanks in advance!
I have the same question (0)
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Make float variable value to be displayed in hours and minutes // Power Automate

     Hi @P3tar,

    Here is thing, int() can only be used for an integer and float() can only be used with a float, which means you could not use the int() if the variable('Result') is a float.

     

    Here is a simple demo for reference:

    vqiaqimsft_0-1678416423553.png

    int(first(split(string(variables('Float')),'.')))
    int(first(split(string(mul(div(float(last(split(string(variables('Float')),'.'))),100),60)),'.')))
    concat(outputs('extract_int_from_the_float_25'),'h ', outputs('extract_float_from_the_float_0.86'),'m')

    vqiaqimsft_1-1678416482679.png

     

  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Make float variable value to be displayed in hours and minutes // Power Automate

    Hopefully this is what you're looking for.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_0-1678411863129.png

     

    Initialize variable contains your original value.

    grantjenkins_1-1678412328298.png

     

    Hours is a Compose that uses the following expression to get the hours.

    first(split(string(variables('Result')), '.'))

    grantjenkins_4-1678415084159.png

     

    Minutes is a Compose that uses the following expression to get the minutes rounded to the nearest minute.

    formatNumber(mul(div(float(last(split(string(variables('Result')), '.'))), 100), 60), 'N0')

    grantjenkins_5-1678415173515.png

     

    Hours and Minutes is a Compose that builds up your hours and minutes.

    concat(outputs('Hours'), 'h ', outputs('Minutes'), 'm')

    grantjenkins_6-1678415242354.png

     

    The final output after running the flow would be:

    grantjenkins_7-1678415333663.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • P3tar Profile Picture
    13 on at
    Re: Make float variable value to be displayed in hours and minutes // Power Automate

    @grantjenkins @v-qiaqi-msft 

    Thanks a lot guys!!

    This is perfect 🙂

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 788 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 452 Moderator

#3
developerAJ Profile Picture

developerAJ 302

Last 30 days Overall leaderboard