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 / Expression to Calculat...
Power Automate
Unanswered

Expression to Calculate Composite

(0) ShareShare
ReportReport
Posted on by

Hi, I am having trouble with an expression in my PowerAutomate Workflow. I was tasked with optimizing a previously manual reporting process, and some of the metrics in the report were not able to be automated completely. As a result, I am using a microsoft form, flow, and sharepoint list to capture some of my data points. However, I am running into an issue in my PowerAutomate Flow that calculates a composite score based on values input into the MS Form. Specifically, my issue is with an expression not behaving as expected. It is a nested If statement, see below: 

 

mul(
if(
    less(float(outputs('get_response_details')?['body/r5953f27b9a604aa9950b24a4b5a04735']), 0.9650),
    0,
    if(
        less(float(outputs('get_response_details')?['body/r5953f27b9a604aa9950b24a4b5a04735']), 1.0),
        div(
            sub(float(outputs('get_response_details')?['body/r5953f27b9a604aa9950b24a4b5a04735']), 0.9650),
            sub(0.9750, 0.9650)
        ),
        if(
            less(float(outputs('get_response_details')?['body/r5953f27b9a604aa9950b24a4b5a04735']), 0.9850),
            add(1,
        div(
                sub(float(outputs('get_response_details')?['body/r5953f27b9a604aa9950b24a4b5a04735']), 0.9750),
                sub(0.9850, 0.9750)
                )),
                2
            )
        )
    ),
    0.25
)
 
In the instance causing the error the output from the MS Form was 0.99, which I am expecting to return a .5. However, when the flow runs it is returning .625. Does someone see something that I don't that is causing this unexpected behavior? 


Categories:
  • Expiscornovus Profile Picture
    33,997 Most Valuable Professional on at

    Hi @raterjacob,

     

    Based your expression I would also expect the outcome of .625. Can you explain why you were expecting .5? Your div calculation returns 2.5 and not 2.

     

    Below is how I got to .625

     

    1. With in the first if you have a less function:

    less(0.99, 0.9650) will return false

     

    2. This will result in the execution of the below part in the second if
    less(0.99, 1.0) will return true

     

    3. That will result in the execution of the div expression part with the two sub functions
    div(sub(0.99, 0.9650), sub(0.9750, 0.9650)) which will return 2.5

    4. When you multiply that you will get 

    mul(2.5, 0.25) will result in 0.625

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard