Forum Discussion
Color Individual rows in Power BI matrix
Makes sense, I don't think what you need is currently possible. Also mentioned here...
Again Thank KNP
Do You have any alternate solution?
- KNP4 years agoSuper User
The best alternative, which in most cases isn't an option, is to use the Table visual instead of the Matrix visual. This gives you more control over the formatting.
One other possibility, check the maketplace to see if there are any custom visuals that could work. Here's one possibility. I've never used it but the reviews look good.
https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA200000642
- Rudz4 years agoKudo Collector
Try using HTML. See Building a custom Gauge Table with HTML (kerrykolosko.com) for a nice walkthrough.
I threw together a quick sample following it that worked fine.
HTML Table = VAR SourceData = ADDCOLUMNS( SUMMARIZE( 'Projects', 'Projects'[Project],Projects[Date] ), "#", COUNTROWS('Projects') ) VAR TableRow = CONCATENATEX( SourceData, "<tr class='"&[DateFlag]&"'>" /* column 1 */ & "<td style='width: 40%;'>" & [Project] & "</td>" /* column 2 */ & "<td><strong>" & [Date] & "</strong></td>" /* column 3 */ & "<td style='width: 40%;'>" & [#] & "</td>" & "</tr>" ) RETURN /* Table Styling */ "<style> table {width: 100%;font-size: 12pt;} td {font-size: 12pt; padding: 3px; border-bottom: 1px solid #ddd;} table tr[class='TRUE'] td {background:#FF0000;} table tr[class='FALSE'] td {background:none;} </style>" /* Table and heading row */ & "<table> <thead> <tr> <th>Project</th> <th>Date</th> <th>Count</th> </tr> </thead> <tbody>" /* Data */ & TableRow /* End of table */ & " </tbody> </table>"With the color being set by:
DateFlag = MAX(Projects[Date]) < TODAY()If you want multiple colors, I would just set the color value in a measure and change the HTML to set the background color in TableRow instead of the style section.
If you need to export to PDF or PowerPoint, use the Shielded HTML custom visual.