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 Apps / Complex Decision Tree ...
Power Apps
Answered

Complex Decision Tree Ideas

(0) ShareShare
ReportReport
Posted on by 118
Hello
 
I have been searching with no solution found.  My aim is to create a Canvas Power App that will host a complex decision tree.  The backend will be Dataverse as the solution will have internal tenant users and guest access users.
 
I have tried to indicate part of the decision ask below.  Each question is multiple choice, Y/N, or more complex.


 
What I have tried to show is that the decision question can lead to further questions.
 
I have considered to tackle this using collections and a gallery.  So the gallery used for A, B, C is filled by those questions in the collection based on the decision question/answer.
 
Ignoring for now A.1, my challenge at the moment is that the questions in A/ B, C can vary, but the multiple choice answers can vary.  I know I can put a drop down in a gallery, but how would I fill each drop down if it can change?
 
 
Or am I over complicating this and there is a easier solution, approach?
 
Thank you for any help you can provide, even if just a suggestion to help me refine my search for an answer.
 
Regards
 
Stuart
Categories:
I have the same question (0)
  • Verified answer
    stum Profile Picture
    144 on at
    Hi,

    You’re not over-complicating it. It's totally doable in Canvas Apps. You should not hard-code your questions or dropdown values. You can store them in Dataverse. Below would be my approach that I would use and it should work even for complex trees.

    You can have your:

    • Questions stored as records
    • Answers stored as records
    • Logic stored as relationships, not formulas

     
    Table 1: Question
     

    Column

    Type

    Purpose

    QuestionId

    GUID

    Primary key

    QuestionText

    Text

    What is shown

    QuestionType

    Choice

    Yes/No, MultipleChoice, Number, Text

    ParentQuestionId

    Lookup (Questions)

    Which question led here

    ParentAnswerId

    Lookup (Answers)

    Which answer triggers this question

    DisplayOrder

    Number

    Order in gallery

    IsActive

    Yes/No

    Control visibility

     

    A question will appears only if its' parent answer was selected.


     
    Table 2: Answer
     

    Column

    Type

    Purpose

    AnswerId

    GUID

    Primary key

    QuestionId

    Lookup (Questions)

    Which question it belongs to

    AnswerText

    Text

    Dropdown / radio value

    NextQuestionGroup

    Optional

    Advanced branching

    Value

    Text/Number

    Optional scoring

     

    Each question can have any number of answers.


     
    Table 3: UserResponse
     

    Column

    Type

    User

    User / Email

    QuestionId

    Lookup

    AnswerId

    Lookup

    SessionId

    GUID

     
    This will allow you to track questions and answers for each user and you can use SessionId for guest users.
     

    Canvas app UI pattern (This solves your dropdown problem)
     
    Single gallery (vertical)

    galQuestions.Items:

    Filter(
        Questions,
        IsActive = true &&
        (
            IsBlank(ParentQuestionId) ||
            ParentAnswerId in colUserAnswers.AnswerId
        )
    )

    With this:

    • Root questions show first
    • Child questions appear only after parent answer is selected

    Dynamic Answer Controls (The Key Insight)

    Use one control per question type, not per question

    Inside the gallery use:

    Switch(
        ThisItem.QuestionType,
        "YesNo", radYesNo,
        "MultipleChoice", drpMulti,
        "Text", txtAnswer,
        "Number", txtNumber
    )

    Only the matching control will be visible.


    How each dropdown will get its own answers

    I think this is the part you were stuck on.

    Dropdown inside gallery, use:

    Items = Filter(
        Answers,
        QuestionId = ThisItem.QuestionId
    )
    With this:
    • Each row gets different answers
    • No collections required
    • Fully data-driven

    To capture the answers

    Use something this OnChange of dropdown/radio then new questions appear automatically.

    Collect(
        colUserAnswers,
        {
            QuestionId: ThisItem.QuestionId,
            AnswerId: drpMulti.Selected.AnswerId
        }
    )

     
    To handle deep trees like (A → A.1 → A.1.a)

    You will have it with table setup because:

    • Each question references to a parent answer
    • Depth won't matter
    • No recursion will be needed

    Hope this helps!


     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard