Forum Discussion
Dynamic table columns based on slicer selection
I am creating a power bi report that is filtered by Month, Year, Employee, Certification. The first column of the table is Day (of the month) that shows even days that do not have data, so I have every day of the month represented. When Employee (and year) are selected, this will filter the Certification slicer. When that Certification is selected, there can be a number of different tasks I need to show based on that cert. I have some very rough sample data here that shows only 5 certs and their related tasks. Each cert can have a different number of tasks. The data source that is coming in is pretty flat (I have no control over it) with 32 columns just for the Task and I know, not the cleanest way to build, but I did not author the data source. Is there a way to dynamically show the columns based on the cert selection? Thanks for the information
UPDATE: I am trying to do the pivot of the columns, however, this breaks the ID column, which has a one to many relationship with other tables.
| ID | Title | Task1 | Task2 | Task3 | Task4 | Task5 | Task6 | Task7 | Task8 | Task9 | Task10 |
| 1 | This One | This one task | 2nd task for this one | And one more | |||||||
| 2 | Second Cert | Task 1 for 2nd | Task 2 for 2nd | ||||||||
| 3 | Make it Three | Task 1 for 3rd | Task 2 for 3rd | Task 3 for 3rd | Task 4 for 3rd | Task 5 for 3rd | Task 6 for Third | ||||
| 4 | I am the Fourth | T1 for Me | T2 for Me | T3 for Me | T4 for Me |
Hi CMSGuy - two primary options: either use a field parameter as your column value, or just unpivot your data. The approach depends on the other details of your reporting. Can be a table or a matrix, doesn't matter.
2 Replies
- CMSGuyHelper III
Now I need to research field parameters as that is something I have not explored using yet. When I do an unpivot, there are actually more than a few columns and are just not the Tasks titles. There is TaskHours and TaskSubmitted numbers too. Not sure how to use that pivoted data when there is more than one different value type