My first visual calculation

Now that you have learned about visual calculations, how easy it is to use them, why they matter, and what problem they solve, you must be eager to try them out for yourself. To that end, this chapter switches from the theoretical approach presented in the previous chapter to real-world examples in which you could use visual calculations. This chapter starts by introducing the semantic model we will be using throughout the book. After that, it guides you through the process of creating visual calculations. You will be introduced to the process of creating visual calculations. Meanwhile, we will touch upon a few new concepts, which will be further explained in the next chapters of this book. The first examples are also building blocks for practical, real-world examples, which will be described in Part IV, “The art of practical visual calculations.”

Introduction to the example semantic model

To help you create your first visual calculations, we have created an example of a semantic model that you can use, which you can find on this book’s companion website (see Introduction). The pbix file Contoso Sales CH2 Start provides a starting point from which you can follow along to do all the steps described in this chapter. The pbix file not only contains the semantic model but also includes a report page called Chapter 2, which serves as the starting point on which we’ll build in this chapter. On the website, you can also find the Contoso Sales CH2 End pbix file, which will match the final version that you will have created if you follow along with all the steps in this chapter. You can check that model to determine whether you did it correctly.

To begin, open the example semantic model in Power BI Desktop. As shown in Figure 2-1, the example model contains data about sales transactions. It’s a simple model that has some dimension tables like Customer, Date, Product, and Store, and contains three fact tables with data about Sales, Orders, and Order Detail. To enable you to start straight away with the visual calculations, we’ve already prepared the necessary relationships and some simple measures, which can be found in a table where all measures are stored. This table is named _Measures.

FIGURE 2.1

FIGURE 2.1 The model view of the example semantic model.

On the Chapter 2 report page, the clustered bar chart on the left shows the Costs and Sales per product category, and the clustered column chart on the right gives the Sales per Month. There is also a slicer to enable you to select different years.

Questions that could arise from this example model include the following:

  • What is the profit per product category?

  • What are the total year-to-date sales?

  • How is the total profit divided over the different countries?

Of course, it’s possible to create measures in Power BI that answer these questions and show them on the report page. However, we’ll employ visual calculations instead because they’re so easy to use.