Power BI Theme JSON tricks

I love Power BI community for the inspiration it gives. Today after reading this LinkedIn post by Jan Schroeven I realized that if Power BI Theme JSON allows to override visual formatting limits enforced by Power BI GUI then I finally have a workaround for what I needed: a table (or matrix) with no header. And for other data visualization in Power BI tricks as well.

I use table (matrix) visuals for custom legends and in tooltips. many times I wanted to hide a header row. Power BI GUI provides no way to hide table (matrix) row header, to set row header height to 0 or to set font size to 0. The only GUI based solution is to choose the smallest font type and set font size to 8. It won’t remove the header, but it will minimize it. Then font color can be changed to white (if background is white) to hide the text. Or the header can be hidden behind a non-transparent shape.

But if we can use theme JSON to set font size to less then 8 then probably we can set it to 0 and it will hide the header row? Yes, it works!

For a test I just took https://github.com/MattRudy/PowerBI-ThemeTemplates/blob/master/Table.json theme JSON and applied it to a report with 2 identical tables:

Before:

After:

Now changing font size for a header row to 0 in the JSON file

saving the changes and re-applying the theme JSON
No header! Almost no header, just a thin green line (color can be change to white), but it’s much better than a header with font size = 8.

But wait. It changed all tables in my report (there were 2). What if I need apply theme JSON only to one table?

No problem. At least for table and matrix native visuals.

Power BI documentation about theme JSON files says:

For the visualName and cardName sections, use a specific visual and card name. Currently, the styleName is always an asterisk (*), but in a future release you'll be able to create different styles for your visuals and give them names (similar to the table and matrix style feature).

Well, it already works for the table and matrix visuals. They have Style preset settings:

Let’s go back to the Table.json and change “*” style name to “Minimal”:

Save it. Re-apply it to the report. Keep style preset = “Default” in the first table and change it to “Minimal” in the second table.

It works!

If you want to use a style name that contains spaces, for example “Falshy Rows”, remove the spaces in JSON file: “FlashyRows”, “ContrastAlternatingRows”.

It looks like Power BI documentations is a little bit outdated. “Currently, the styleName is always an asterisk (*)” part is not true. You can change the styleName and you can customize table and matrix visual styles!

Share the article