Forum Discussion
Creating a dynamic questionnaire in Power BI
Hi there! I want to create a "decision support tool" in Power BI that helps users decide on which labor type (e.g. Contingent Worker, Full-Time Employee, or Statement of Work) they should employ for a project. I've setup a table in PBI that I'm calling "QuestionFlow" (see below). As you can see, based on the users Yes/No answers to the various questions I either want another question to display or a specific text value to display for the user. I've created another table called "UserResponse" which simply has values of "Yes" and "No" and then I created a slicer from that. At this point I'm stuck on the DAX to write (I'm a rookie) in order to dynamically display the series of questions/text based on the user's responses. Any guidance would be greatly appreciated!
| QuestionID | QuestionText | YesNextQuestionID | NoNextQuestionID |
| Q1 | Is there a specific project that needs completion? | Q2 | Q3 |
| Q2 | Will this specific project have a defined scope of work that limits what will be performed? | Q4 | Q5 |
| Q3 | Is this role to temporarily handle excess workload or to cover an FTE out on leave? | Contingent Worker | Q6 |
| Q4 | Do the deliverables have defined schedule and due dates for deliverables? | Q7 | Contingent Worker |
| Q5 | Do you need to ramp up quickly or have urgent work? | Q8 | Q6 |
| Q6A | Is the expected role tenure Long Term (Over 12 Months) or indefinite? | Q9A | Q10A |
| Q6B | Is the expected role tenure Long Term (Over 12 Months) or indefinite? | Q9B | Contingent Worker |
| Q7 | Will there be penalties associated with delayed deliverables or poor quality? | Q11 | Contingent Worker |
| Q8 | Does your labor need for the role experience fluctuations in service demands? | Q10B | Contingent Worker |
| Q9A | Will the client invest in worker training & development? | Full Time Employee | Contingent Worker |
| Q9B | Will the client invest in worker training & development? | Full Time Employee | Contingent Worker |
| Q9C | Will the client invest in worker training & development? | Full Time Employee | Contingent Worker |
| Q10A | Does the role require ongoing expertise or project-specific skills? | Contingent Worker | Contingent Worker |
| Q10B | Does the role require ongoing expertise or project-specific skills? | Contingent Worker | Q9C |
| Q11 | Is there a need for tight budget controls for this role? | Statement of Work | Statement of Work |
- Anonymous2 years ago
Hi Bali2022 ,
Below is my table:
The following DAX might work for you:
NextQuestion = IF ( SELECTEDVALUE('UserResponse'[Column1]) = "Yes", LOOKUPVALUE('Table'[YesNextQuestionID], 'Table'[QuestionID], SELECTEDVALUE('Table'[QuestionID])), LOOKUPVALUE('Table'[NoNextQuestionID], 'Table'[QuestionID], SELECTEDVALUE('Table'[QuestionID])) )The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Bali2022 ,
Below is my table:
The following DAX might work for you:
NextQuestion = IF ( SELECTEDVALUE('UserResponse'[Column1]) = "Yes", LOOKUPVALUE('Table'[YesNextQuestionID], 'Table'[QuestionID], SELECTEDVALUE('Table'[QuestionID])), LOOKUPVALUE('Table'[NoNextQuestionID], 'Table'[QuestionID], SELECTEDVALUE('Table'[QuestionID])) )The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.