Forum Discussion
How to add section names as text boxes (which scrolls with the columns) to column headings?
I would like to add a section name to each group of columns. When scrolling the report (horizontally) I would like for the section names to move with each section's associated columns. Below is an example of the condensed report, each section is associated with specific columns. I am using text boxes for the sections but the text boxes don't move when scrolling. May be I shouldn't be using text boxes. Thanks in advance for all assistance.
Hi PBIFanHook7
You're using separate columns but sections/hierarchies are only possible with matrix. Your data as separate columns insn't in the proper shape to achieve what you want. You will need to unpivot your table, add some indicator which values belong to which rows (with an index column) and a custom column to identify which section the unpivoted column headers belong to and then add the fields to a matrix visual and make it appearl like a sectioned table. That would be the general approach which might not be enough depending on the complexity of your data. Please see the attached sample pbix.
8 Replies
- danextian
Super User
Hi PBIFanHook7
You're using separate columns but sections/hierarchies are only possible with matrix. Your data as separate columns insn't in the proper shape to achieve what you want. You will need to unpivot your table, add some indicator which values belong to which rows (with an index column) and a custom column to identify which section the unpivoted column headers belong to and then add the fields to a matrix visual and make it appearl like a sectioned table. That would be the general approach which might not be enough depending on the complexity of your data. Please see the attached sample pbix.
- PBIFanHook7
Helper III
Dane, thanks for the excellent response and solution. I thought Microsoft would make this a little bit simplier.
- danextian
Super User
Think of a Power BI matrix viz as a very close relative of pivot tables in Excel. That, you can't do with pivot tables unless your data in Excel is also unpivoted.
- PBIFanHook7
Helper III
danextian , follow-up question, how may I change the background color and font color for Section 1, Section 2, and Section 3 and their respective columns. For example, I may want to make Section 1 red, Section 2 blue, and Section 3 green and make their columns the same color. Thanks. (I am not sure if I should make a new post.)
- ryan_mayu
Super User
you can try to use grouping and binning , then display the grouping column
- Shahid12523
Community Champion
In Power BI (Matrix visual):
Unpivot your columns in Power Query.
Use Matrix with a multi-level column header:
Section Name → Column Name → Value.
- AnonymousNot applicable
Hi PBIFanHook7 ,
I would also take a moment to thank danextian , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions
- PBIFanHook7
Helper III
I marked danextian response as the solution. Thanks.