web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Loop through all respo...
Power Automate
Suggested Answer

Loop through all responses in MS Forms.

(0) ShareShare
ReportReport
Posted on by 158
Hello! I have an MS Forms with over 20 questions, but due to branching, the user won't be able to answer it all.

Is there a way to loop all questions in my Forms and filter only all the questions that has an answer?

I already have a working flow, but I'm using a Compose action and collecting each value one by one. Something like this:


My goal is to eliminate doing all this one by one. The reason for that is because the questions in my Forms aren't final yet. So in the future, the questions might change and I wouldn't need to put the new questions again inside the Compose action. Goal is even though the questions in my Forms change, I wouldn't need to edit the flow.

The question is, is it possible? To just loop through all responses and filter only the answered questions?

Thank you and have a good day.
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    12,970 Super User 2025 Season 2 on at
    I am not sure I understand your looping concept based on the image of your flow. However, you can wrap each question in a coalesce expression and put the question first and then add ", ''" after it to return blank. You can learn more about this expression at Blank, Coalesce, IsBlank, and IsEmpty functions - Power Platform | Microsoft Learn
  • _maaaaavs_ Profile Picture
    158 on at
    Hi, David MA!

    Thank you for the answer. Sorry for the confusion, just disregard the image.

    Is there just a way to capture all responses in my MS Forms and filter only the responses that has answers?

    I'm just looking for alternatives work arounds here and simpler way to eliminate tedious step by setting them one by one inside the Compose action just like I did in the image.

    For context and example:
    Lets say I have a Form with 5 questions. So Question 1,2,3,4, and 5. But since I have branching in my Forms, the user can only answer Question 1,2, and 5.
    What I'm trying to do in Power Automate is loop all of that 5 Questions, and since Question 1,2, and 5 only has answers, it will only filter that.
    So in theory, the output would look like this:

    Question 1: Yes
    Question 2: Yes
    Question 5: No

    Is this possible to do in Power Automate?
     
  • David_MA Profile Picture
    12,970 Super User 2025 Season 2 on at
    There is no way to do what you want without writing an expression for each question in your form, at least that I know of. The coalesce expression would be ideal for this. You could have the output be:
     
    Question 1: Yes
    Question 2: Yes
    Question 3: No response
    Question 4: No response
    Question 5: No
     
    I suppose if you create an array, and then create a coalesce expression on each question, you could then add the result to your array. You could then filter the array to exclude items that contain No response.
     
    Action: Filter array
    From: FilteredResponses
    Condition: @not(contains(item(), 'No response'))
  • Suggested answer
    Karel (ACSW) Profile Picture
    48 on at
    Hi there, I spent a bit of time researching this usecase for a similar project.
    I've found the best / reliable way to do this is either with an Excel Online table or a simple JSON array.
     
    If you use the Excel online, you create a table w/ a column for ALL possible answers,
    you (sadly) still need to output each response value to the specific column in Excel via the 'Create row' action.
     
    The same with a JSON array, you map all values with key, but make sure to allow null values (!).
     
    Both methods need you to map out all the possible answers once, and the result will be
    a tablerow or JSON array that holds values (for all the answered questions) or empty/null/blank values for skipped answers.
     
    Now comes the fun part, you can now loop through the row (for each cell in tablerow) or the array (for each value in array)
    with the condition is not empty (or null or blank) and then append the non-empty key + value to an object or array in your flow.
     
    This will result in your object/array holding all the filled in answers from the initial response, which you can then use for other automation purposes.
     
    PS: I use this logic to generate an Adaptive Card where the HTML body is generated based on the amount of key-value pairs I have. Works great.
  • _maaaaavs_ Profile Picture
    158 on at
    Hi, David MA!

    Thank you for that. I would definitely try that solution.

    But I've also thought of another work around but I'm not sure if it's doable or possible.

    What If I store the responses in a SharePoint List? Lets say I have 6 columns. And I only want to filter the columns with values only. Is it possible?

    |  ID   |    Question 1  |   Question 2  |   Question 3  |   Question 4   |  Question 5   |
       
       1               Yes                  Yes                                                                 No 


    Is there a way to filter that? In theory, the output will be:

    ID                         1
    Question 1          Yes
    Question 2          Yes
    Question 5          No
  • David_MA Profile Picture
    12,970 Super User 2025 Season 2 on at
    Re: "What If I store the responses in a SharePoint List? Lets say I have 6 columns. And I only want to filter the columns with values only. Is it possible?"

    If you store the responses in a SharePoint List and want to filter out entries with null values, it would be quite challenging. SharePoint's list view filtering is designed to handle one column at a time. This means you can only filter based on one question at a time, which isn't practical if you have multiple questions. Additionally, for open-ended text questions, you would need to manually select each unique response to filter out the null values, making the process cumbersome and inefficient.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard