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 / Converting string to I...
Power Automate
Answered

Converting string to INT to calculate and then convert back

(0) ShareShare
ReportReport
Posted on by 2

I wonder if someone could advise, I'm struggling to find an efficient way to create an employee performance tracker, without creating a million variables and compose objects. This is mostly just my lack of experience with expression formulation.

 

I have an MS form that I'm outputting to flow to add to a Sharepoint list and email results in a table. I'm sending the following string values to my flow:

 

There are 5 possible outputs from the questions:

Not yet

Occasionally / Somewhat

Often

Mostly

Always

 

In the flow I want to convert these to integers to be able to show a section average - which I have achieved below. 

 

if(equals(variables('A1'),'Always'),int('5'),if(equals(variables('A1'),'Mostly'),int('4'),if(equals(variables('A1'),'Often'),int('3'),if(equals(variables('A1'),'Occasionally'),int('2'),if(equals(variables('A1'),'Somewhat'),int('2'),if(equals(variables('A1'),'Rarely or Not yet'),int('1'),''))))))

 

I am then setting the output of this back to the original string variable. I am doing this for every single question which seems ridiculous but I don't know another way. Any suggestions with code examples on how to improve this would be amazing - I feel like I just need a global function that I could call..

 

I then want to add them all together and divide them by the number of questions in the section to get a mean average. This isn't working at the moment as I *think* it still thinks the variable is a string not an INT - not sure what I am doing wrong here.. 

 

Finally, the icing on the cake would be to convert the average score back to one of the corresponding levels below so that it's more meaningful when output into an email. 

 

Level 1 - New
Level 2 - Learning
Level 3 - Developing
Level 4 - Mastering
Level 5 - Mastery

 

Any help would be amazing - TIA

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @RecTechMandy ,

     

    I did a sample for you.

    vxiaochenmsft_0-1655434130764.png

    vxiaochenmsft_1-1655434141012.png

    vxiaochenmsft_2-1655434151718.png

    vxiaochenmsft_3-1655434161351.png

    vxiaochenmsft_4-1655434172970.png

     

    Best Regards,

    Wearsky

  • RecTechMandy Profile Picture
    2 on at

    Hi Wearsky,

     

    That isn't exactly what I was asking but that is really useful! Thanks. I need to then be able to convert a number back to a useful string once the average has been calculated. Thanks Mandy

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 791

#2
Valantis Profile Picture

Valantis 582

#3
Haque Profile Picture

Haque 529

Last 30 days Overall leaderboard