© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
A. AspinPro Power BI Theme Creationhttps://doi.org/10.1007/978-1-4842-7068-4_1

1. Introduction to Power BI Themes

Adam Aspin1  
(1)
STAFFORD, UK
 

Power BI has taken the world by storm when it comes to creating attention-grabbing dashboards that empower users. It has come to dominate the analytics arena with its ease of use, wide range of connectivity options, and the variety of available visuals.

However, formatting (and reformatting) dashboard visuals can prove time-consuming and repetitive – as can standardizing the presentation of multiple dashboards to create a unified look and feel for a suite of reports. Most users would rather spend their time analyzing and delivering meaningful insights as opposed to applying colors and font choices to charts and tables.

This is where the creation and application of Power BI themes comes in. A theme is a standardized definition of some – or all – of the formatting of a dashboard. This can range from defining a color palette and a selection of font choices to the detailed specification of each and every visual. Applying a theme allows you to format virtually every visual in a dashboard instantly. What is more, any changes that you subsequently make to a theme can be reapplied in a few clicks to update your dashboard’s presentation. Themes can be created once, then applied to dozens or even hundreds of Power BI dashboards to guarantee a coherent and rigorously standardized presentation style across a department or even an entire organization.

Themes can be as simple – or as detailed – as you require. They can specify standardized fonts, text colors, and font sizes or set the tiniest details of how each individual type of visual is formatted. Indeed, themes are designed to work at multiple levels – starting with general elements and then progressing deeper and deeper into tightly specified definitions of the presentation of each element in a dashboard. This gives you a range of options when it comes to defining how you standardize Power BI dashboards.

Theme Basics

Themes are, technically, JSON files. That is, they use the JSON (JavaScript Object Notation) format to store the definition of how dashboard objects are formatted. But don’t worry if you have never used – or even heard of – JSON before now, as I will be explaining all you need to know about it during the course of this book. The only thing to retain for the moment is that themes are like external stylesheets for Power BI (very like the stylesheets that are used by Microsoft Word, for instance). The advantage of defining formats with external files is that you can simply send your colleagues themes as small text-based files that they can then apply in a few clicks to any of their own Power BI dashboards. Themes can also be integrated into Power BI templates to accelerate even further the dashboard creation process.

Themes are applied to Power BI Desktop files. Once loaded, they become an integral part of the Power BI Desktop .pbix file. The formatting is then, of course, carried over into the Power BI service when you publish the dashboard. Moreover, you can switch between different theme files in a few clicks to try out different formatting approaches or apply a completely different look and feel. Equally fortunately, there is nothing definitive about applying a theme file, as you can switch to another Power BI presentation style based on a different theme at any time. So you are free to experiment with different styles until you find the look and feel that suits the particular dashboard that you are creating.

A theme allows you to preset virtually anything that is defined in the Power BI formatting pane. Consequently, it can contain formatting definitions for
  • The color palette

  • The page

  • Inserted objects (text boxes, shapes, buttons, and images)

  • Built-in visuals (tables, charts, maps, and other visuals)

You can even apply a theme to the Power BI Desktop Filter pane. The principle is simple: if you can alter presentation in the formatting pane of Power BI Desktop, then you can define the format using a theme file.

The portable nature of dashboard themes means that there are now a wide range of different themes that are freely available to enhance the presentation of Power BI dashboards. You may even have experimented with some of the themes that are available as an integral part of Power BI Desktop or shared through the Web.

After reading this book and learning how these themes are created, you, too, will be able to develop themes that you can share – with friends, colleagues, or even the world.

Anatomy of a Theme

It is important to understand from the start that themes operate at two distinct levels. Firstly, themes can be defined to operate in a “generic” way. That is, you can define a set of high-level specifications to set core aspects of a dashboard and the visuals it contains without going into low levels of detail. This way you can quickly and easily define
  • Colors

  • Standard font attributes

  • Shared elements for all visuals

  • Certain elements specific to certain types of visuals

You will discover how to create “generic” themes in Chapter 3.

Then, at a more detailed level (and once you have acquired a thorough understanding of how themes work), you can specify the exact formatting for each and every element of each visual to give you total control of the appearance of each element in a dashboard. An in-depth definition of the JSON that is required at the level of individual visuals is the subject of Chapters 5 through 12.

However, don’t get the idea that you have to choose between two different approaches. The truth is that a theme JSON file can “mix and match” the two approaches so that you can both define a set of overall style principles and then add highly specific definitions of the way that you want certain visuals to be displayed in a dashboard. The principle will always be that a more generic level of formatting applies unless a more detailed definition is found in the theme file.

Themes and the Format Pane

A theme is nothing more than the definition of the formatting that you would otherwise apply manually using the Power BI format pane. It follows that you need to know what the format pane is and how it is used to format dashboard objects. I will not be explaining the intricacies of the Format Pane in this book, however, and refer you to my book Pro Power BI Desktop for full details on how to format dashboards manually.

Nonetheless, it is worth reminding yourself of the core elements in the Format Pane and how formatting works at a generic level.

Essentially, formatting is a hierarchy of three elements:
  • Visual (a table or chart – although this could be the page as well).

  • Element: This is the aspect of a visual that you want to format. This corresponds to the expandable sections of the formatting pane in Power BI Desktop (they are also called tabs or cards). The X axis section for a chart is an example of this.

  • Property (often referred to as an attribute): This is the specific setting you define. This could be the font color, for instance.

You can see this (for a stacked bar chart visual) in Figure 1-1, where the Data labels element is expanded to show all the available properties that you can set for data labels.
../images/511180_1_En_1_Chapter/511180_1_En_1_Fig1_HTML.jpg
Figure 1-1

The Format Pane

It is important to bear this hierarchy in mind when creating theme files, as the entire JSON structure is predicated on this nested approach – as will be explained further in Chapter 3.

Writing JSON Files

As you will have to write or adapt actual JSON files for all but the simplest theme files, you will need to choose a tool to carry out your modifications. As JSON is a text-based format, there is a plethora of tools that are available to do this. It is entirely up to you to select a tool that you are happy with. A few that I have used are
  • Notepad

  • Notepad++

  • Visual Studio

  • Visual Studio Code

  • An online JSON editor

There are literally dozens of tools available, and the choice of an application to use is entirely up to you. My only advice is to find something that you are comfortable with and that provides you with the balance of usability and power that you require. Above all, it must be able to save or export text files. As, in practice, you are likely to test and revise your choices over and over again, the tool that you choose needs to have multiple levels of undo and redo as well as having a powerful search and replace capability.

A tool that displays JSON in an easy-to-read format is a must when writing theme files for Power BI. This is because the JSON structure used by Power BI Desktop can get intricate, and consequently it helps considerably to be able to see the nested levels of text and how they are structured. However, I don’t want to get too far ahead, yet, so will come back to this later in the book.

If you have not yet made up your mind, I suggest downloading Notepad++. This is a free text editor that can display JSON in a very readable format.

Applying Themes

Before looking at how you create your own themes, it is probably best that I remind you of the far-reaching effects that themes can deliver. Hopefully, this will incentivize you to want to learn more and encourage you how to create your own theme files.

Take, for instance, a very simple dashboard like the one shown in Figure 1-2. (This is the file SampleDashboard.pbix from the sample files.)
../images/511180_1_En_1_Chapter/511180_1_En_1_Fig2_HTML.jpg
Figure 1-2

An unformatted dashboard

This dashboard is strictly “plain vanilla.” That is, no formatting has been applied at all. Imagine that this dashboard were a 15-page report and that you have to make it not only presentable but also mapping to a corporate standard. This could take hours in a worst-case scenario.

However, you are fortunate enough to have a theme JSON file available that defines all the corporate standards. To apply it, all you have to do is
  1. 1.

    Click View to activate the View ribbon.

     
  2. 2.

    Click the Themes popup.

     
  3. 3.

    Click Browse for themes.

     
  4. 4.

    Navigate to the sample files and select the theme file (BaseTheme.json in this example).

     
  5. 5.

    Click Open. After a few seconds, you will see the dialog in Figure 1-3.

     
../images/511180_1_En_1_Chapter/511180_1_En_1_Fig3_HTML.jpg
Figure 1-3

Successful theme file import

  1. 6.

    Click Close.

     
That is it! Your dashboard (every object on every page) is now formatted, instantly. The result is shown in Figure 1-4.
../images/511180_1_En_1_Chapter/511180_1_En_1_Fig4_HTML.jpg
Figure 1-4

A dashboard after applying a theme file

You can now add any final formatting that you require to override the theme at the level of individual elements (a theme, after all, is a time-saver – not a straitjacket). The end result is almost certainly that you have saved a vast amount of time adding presentational touches and have ensured that your dashboard conforms to a standard look and feel.

Note

The theme file that you applied in this example is not designed to show off subtleties of dashboard design – nor is it based on cutting-edge design principles. It is, however, designed to illustrate how quick and easy it is to reformat an entire dashboard using a theme file.

Conclusion

In this chapter, you have seen what themes are all about and exactly how powerful they can be. It is time, now, to move on to creating your own themes. Initially, we will begin by using Power BI Desktop to write the JSON for you – as you will discover in the next chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.66.178