Earn recognition and rewards for your Microsoft Fabric Community contributions and become the hero our community deserves.
Learn moreSee when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
Hi, I'm working on an audit report in Power BI.
I have a slicer for selecting auditoria_id, and within each audit, there are several sections (Sección.nombre, like "SECTION 1", "FINAL SECTION", etc.).
I would like that when I select one audit, it dynamically displays only the sections that belong to that audit, and for each section, a header with its name followed by its related questions and answers.
For example:
If audit 10 has 3 sections, I want to see 3 blocks: one for each section with its questions and answers.
If another audit has only 2 sections, then only those two should appear.
Is it possible to do this dynamically in Power BI without creating one visual per section manually?
Thank you very much!
Hi @Adriana1993 ,
I hope the information shared was helpful. If you have any additional questions or would like to explore the topic further, feel free to reach out. If any of the responses resolved your issue, please mark it "Accept as solution" and give it a 'Kudos' to support other members in the community.
Thank you!
Hi @Adriana1993 ,
I wanted to follow up and see if you’ve had a chance to review the information provided here.
If any of the responses helped solve your issue, please consider marking it "Accept as Solution" and giving it a 'Kudos' to help others easily find it.
Let me know if you have any further questions!
Hi @Adriana1993 , Thank you for reaching out to the Microsoft Community Forum.
Let us assume you have four tables: Audits:
AuditID (PK) |
AuditName |
Date |
|
1 |
Safety Audit |
2024-01-15 |
|
2 |
Compliance Check |
2024-02-03 |
Sections:
SectionID (PK) |
AuditID (FK) |
SectionName |
10 |
1 |
General Info |
11 |
1 |
Final Comments |
12 |
2 |
Compliance Items |
Questions:
QuestionID (PK) |
SectionID (FK) |
QuestionText |
100 |
10 |
What is your name? |
101 |
10 |
What is your role? |
102 |
11 |
Any final remarks? |
Answers:
AnswerID (PK) |
QuestionID (FK) |
AuditID (FK) |
Answer |
1000 |
100 |
1 |
John Smith |
1001 |
101 |
1 |
Inspector |
1002 |
102 |
1 |
All good |
Then, make sure your data model has these relationships: Audits[AuditID] -> Sections[AuditID], Sections[SectionID] -> Questions[SectionID], Questions[QuestionID] -> Answers[QuestionID]
If answers are tied to a specific audit, include AuditID in the Answers table and link it to Audits[AuditID]. All relationships must be active and properly defined in Power BI's model view. Create the below DAX measure:
AnswerText =
CONCATENATEX(
VALUES(Answers[Answer]),
Answers[Answer],
", "
)
Add a slicer to your report using Audits[AuditID]. This filters the report to show only data related to the selected audit. Then, insert a Matrix visual. In the Rows, add Sections[SectionName] followed by Questions[QuestionText]. In Values, add the AnswerText measure. Finally, go to the Matrix formatting pane and enable “Stepped layout” under Row headers to clearly indent questions under each section.
If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Let’s assume you have the following tables:
Table |
Key Columns |
Auditorias |
auditoria_id |
Secciones |
seccion_id, nombre, auditoria_id |
Preguntas |
pregunta_id, texto, seccion_id |
Respuestas |
pregunta_id, respuesta, auditoria_id (or linked indirectly) |
Place a slicer on the page using the auditoria_id field from your Auditorias table.
If you want to show section headers within a table or matrix visual, Power BI doesn’t support visual-level grouping like that. But we can simulate it.
Create a calculated column in your Preguntas table:
DisplayText =
"[" & RELATED(Secciones[nombre]) & "] " & Preguntas[texto]
This gives you:
[SECTION 1] What is your name?
[FINAL SECTION] Any comments?
In a Power BI Table visual:
Apply sorting by:
Then it will group by section automatically (with no manual visuals), like this:
Section Name |
Question |
Answer |
SECTION 1 |
What is your name? |
John |
SECTION 1 |
Age? |
25 |
FINAL SECTION |
Any comments? |
None |
Use Matrix Visual for Collapsible Sections
If you want collapsible sections:
Now, each section becomes expandable/collapsible automatically.
User | Count |
---|---|
84 | |
70 | |
64 | |
58 | |
58 |
User | Count |
---|---|
46 | |
37 | |
34 | |
33 | |
29 |