Forum Discussion
Formatting a row in bold/background
Hi all,
Newbie here, im pulling together a p&l using a table format. Advice from here said to write a dax rule on the row headings to enable me to use for conditional formatting of specific lines eg gross revenue. I shaded these. However how can I make the column with headings bold for those that say revenue, gross profit etc? Is the best workaround to make the table a lighter font then a darker font for those?
Hi Aqua1
In Power BI, you cannot directly format column headers based on row values. Conditional formatting works on cell values, not headers.
Here’s a common approach:
Create a DAX measure to flag the rows you want to emphasize, for example:
HighlightRevenue = IF( 'P&L'[RowName] IN {"Gross Revenue", "Revenue", "Gross Profit"}, 1, 0 )Apply conditional formatting (font color or background color) on the values in the table/matrix based on this measure.
For headers, a common workaround is to make the default table font lighter, then use the conditional formatting to make “Revenue” or “Gross Profit” rows darker/bold—this visually emphasizes those lines.
This achieves the effect you want even though headers themselves cannot be dynamically bolded.
If this helps, consider marking it as the solution and giving a kudo!
Nabha Ahmed
Hi Aqua1,
Conditional formatting on row and column headers is currently not supported. Changing to font to bold also cannot be controlled with conditional formatting. The only way for the font to become bold is it becomes a subtotal row - not another row separate from its own line items. You can achieve that by using a hierarchichal table. In the image below, the upper hiearachy is P&L Group and below it is Line Items:
You can write a condition to return blank if P&L Group is Gross Profit and Line Items is expanded otherwise you return the desired value.
VAR _group = SELECTEDVALUE ( DisplayTable[P&L Group] ) RETURN IF ( _group = "Gross Profit" && ISINSCOPE ( DisplayTable[Line Items] ), BLANK (), [pnl value] )The image below shows that Gross Profit is a subtotal row, the font is bold and although expanded doesn't have line items below it. If the user doesn't need to expand/ collapse the rows, you can just icon the icons as well.
5 Replies
- Nabha-Ahmed
Super User
Hi Aqua1
In Power BI, you cannot directly format column headers based on row values. Conditional formatting works on cell values, not headers.
Here’s a common approach:
Create a DAX measure to flag the rows you want to emphasize, for example:
HighlightRevenue = IF( 'P&L'[RowName] IN {"Gross Revenue", "Revenue", "Gross Profit"}, 1, 0 )Apply conditional formatting (font color or background color) on the values in the table/matrix based on this measure.
For headers, a common workaround is to make the default table font lighter, then use the conditional formatting to make “Revenue” or “Gross Profit” rows darker/bold—this visually emphasizes those lines.
This achieves the effect you want even though headers themselves cannot be dynamically bolded.
If this helps, consider marking it as the solution and giving a kudo!
Nabha Ahmed
- danextian
Super User
Hi Aqua1,
Conditional formatting on row and column headers is currently not supported. Changing to font to bold also cannot be controlled with conditional formatting. The only way for the font to become bold is it becomes a subtotal row - not another row separate from its own line items. You can achieve that by using a hierarchichal table. In the image below, the upper hiearachy is P&L Group and below it is Line Items:
You can write a condition to return blank if P&L Group is Gross Profit and Line Items is expanded otherwise you return the desired value.
VAR _group = SELECTEDVALUE ( DisplayTable[P&L Group] ) RETURN IF ( _group = "Gross Profit" && ISINSCOPE ( DisplayTable[Line Items] ), BLANK (), [pnl value] )The image below shows that Gross Profit is a subtotal row, the font is bold and although expanded doesn't have line items below it. If the user doesn't need to expand/ collapse the rows, you can just icon the icons as well.
- AnonymousNot applicable
Hi Aqua1,
I would also take a moment to thank danextian , Nabha-Ahmed 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.
Regards,
Harshitha.- AnonymousNot applicable
Hi Aqua1,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.
Regards,
Community Support Team.