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 multiple ch...
Power Automate
Suggested Answer

Converting multiple choice form answer into sum total

(1) ShareShare
ReportReport
Posted on by 2
Hi,
 
I'm creating a form for holiday activities. I have a multiple choice question where people can select which activities they're interested in. 
 
I want to use their selections to calculate how much they will owe.
 
Eg. If the options are:
 
- Archery (£10)
- Bowling (£5)
- Zoo (£15)
 
And the person selects Archery and Zoo, power automate will add up those values (£10 + £15), and send an email telling the person the total amount will be £25.
 
I have tried using switch to convert them into a numerical value, but am unsure how to create a sum from that.
 
Thank you so much!
Categories:
I have the same question (0)
  • Suggested answer
    Ravi-Prajapati Profile Picture
    416 Moderator on at

    ou can achieve this in Power Automate by following these steps:


    1️⃣ Trigger: "When a form response is submitted"

    • Use "Microsoft Forms - Get response details" to retrieve the submitted answers.

    2️⃣ Parse Multiple Choice Answers

    • The multiple-choice response will come as an array (e.g., ["Archery", "Zoo"]).
    • You need to assign values to each activity and sum them up.

    3️⃣ Use a Loop to Calculate the Total Cost

    1. Initialize a variable:

      • Type: Integer
      • Name: TotalCost
      • Value: 0
    2. Use "Apply to each" to loop through the selected activities.

    3. Inside the loop, use a condition or Switch case:

      • If "Archery" → Add 10 to TotalCost
      • If "Bowling" → Add 5 to TotalCost
      • If "Zoo" → Add 15 to TotalCost

    Expression to update variable:

    add(variables('TotalCost'), 10) // Replace 10 with correct value

    4️⃣ Send Email with the Total Cost

    • After the loop, use "Send an email" action.
    • In the body of the email, include:
      Thank you for signing up! Your total cost for the selected activities is £@{variables('TotalCost')}.

    Alternative: Using an Array and Lookup

    Instead of a Switch case, you can create a key-value array and lookup values dynamically:

    Create an array in Power Automate:

    [
    {"Activity": "Archery", "Price": 10},
    {"Activity": "Bowling", "Price": 5},
    {"Activity": "Zoo", "Price": 15}
    ]

    Use a loop to match selected activities:

    For each selected activity, find the matching price and sum them.

  • CU17021558-0 Profile Picture
    2 on at
    Thank you Ravi!
     
    I'm really struggling with step 3. I've attached a screenshot of my flow.
     
    Could you please break down how to set up the switches?
     
    Many thanks
    Anna
    Screenshot 2025-02-24 174303.png
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    Do this.
    I created a form with a multi choice that looks like this. I want dad to be 5 points, mom 10 and partner 15
     
    1. Trigger
    2. Get response detail
    3. create an INT variable and set it to 0
    4. Create an Options Array variable and add this express
    However, please change the body/rd3xxxx to YOUR dynamic property on your form
    You have to change the STRING that gets passed in for your multi-choice (just like mine) to an actual array. Its not an array right now
     
    Initially it looks like this when it comes in
    ["Dad","Mom"]
    We need to do 4 things
     
    1. replace the [ with an empty string
    2. replace ] with an empty string
    3. replace "" with empty string
    4. then SPLIT the final part which looks like
     
    Dad,Mom by the , and make it an array in the Initialiaze array action below
    split(
       replace(
          replace(
            replace(outputs('Get_response_details')?['body/rd377696685054b2e953b800c210ba38c'], 
            '[','')
          ,']','')
       , '"', '')
    ,',')
    
    
    
     
     
    Now its time for our switch which is INside our Loop, which is looping on the Options array variable from the top
     
     
    Then I just have an increment variable inside each case.
    And then I have an ending compose JUST to show the value
     
    Now when I run it and Select Mom and Dad from my Form I should get 15 points total
     
    And I do
     

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 Launch!

Jump in, show your community spirit, and win prizes!

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 476

#2
Haque Profile Picture

Haque 424

#3
David_MA Profile Picture

David_MA 350 Super User 2026 Season 1

Last 30 days Overall leaderboard