Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

add multiple mul functions to get a grand total

Posted on by 2
 
i have 7 sub totals in a mul function ==> 
 
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghettiB'],15)
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghettiv'],15)
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghetti4'],15)
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xMacaronihe'],15)
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xKaasschote'],20)
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xKinderspag'],10)
mul(outputs('Create_item')?['body/Kindermacaroni'],10)
 
 
and now i want to add the 7 mul functions with eachother so  i tried 
 
add(
mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghettiB'],15), add(mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghettiv'],15),add(mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xSpaghetti4'],15),add(mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xMacaronihe'],15),add(mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xKaasschote'],20),add(mul(outputs('Create_item')?['body/OData__x002e__x002e__x002e_xKinderspag'],10),add(mul(outputs('Create_item')?['body/Kindermacaroni'],10))))))))
 
but this is not working.
 
In the end people who are ordering can see the total per line, but i want to give them also a grand total in the email the recieve
  • David_MA Profile Picture
    David_MA 7,541 on at
    add multiple mul functions to get a grand total
    Thanks for the update. Simple enough then since the expressions are not generated in an apply to each action or anything. I would then do what I suggested below and create a float variable, and then use seven increment variable actions with the seven expressions you have to generate the total. If the questions are not required, I would also suggest using a coalesce expression to return 0 if it is blank. For example: float(coalesce(items('Apply_to_each_Item')?['_f9fafdb0d76d4cc8b5217c9d23ef0a59']?['#text'], '0')).
     
    This is an example of using the increment action in an Apply to each with the above expression to generate a total:
     
  • Levi Lenaers Profile Picture
    Levi Lenaers 2 on at
    add multiple mul functions to get a grand total
    if you mean this ?  I get al the data from a form
     
  • David_MA Profile Picture
    David_MA 7,541 on at
    add multiple mul functions to get a grand total
    You don't show your flow, so it is difficult to understand how this is working. I would create a float variable and set the initial value to zero (0). You would then use seven Increment variable actions on the seven mul expressions to calculate the grand total (provided those are working). You may need to wrap each one of those into a float expression when you increment the variable. This approach helps avoid potential issues with complex nested expressions and makes the flow easier to manage and debug.

    This way, if one of the seven mul expressions fails, you will know exactly which one it is for debugging.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard