Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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? 


  • Expiscornovus Profile Picture
    32,131 Most Valuable Professional on at
    Re: Expression to Calculate Composite

    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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1