Přejdi na obsah Přejdi na navigaci

HomepageBlogReport Portal in Power BI

Report Portal in Power BI

Power BI allows you to access reports based on workspaces, but this is not always practical or clear to the user. For these reasons, we received a request to create our own Report Portal in Power BI. It should be possible to click through from this Report Portal to the relevant report. Reports in the Report Portal should be clearly structured by department or logical unit. The whole solution should respect security rules at report or department level. We once implemented a similar requirement in IBM Cognos and its implementation was often requested by customers.

rozcestník

We would like to share with you our findings and the interesting thought process that led to the creation of the final solution. You can see the result in the picture on the front page.

Source file preparation

The first step in the Report Portal development process was to create a source file containing a list of reports. By this stage we had already established that the most appropriate type of visual for our purposes would be a matrix table, which was the only one that would allow us to dynamically list values in imaginary grid coordinates. The source file therefore contained the following columns

rozcestník02

Such a structure is sufficient for a basic test of whether it will be possible to distribute the reports in a grid. We imported the table into PowerBI, added two more tables - a Row table (with a single Row ID column and values {1,2,3}) and a Col table (with a single Col ID column and values {1,2,3,4}), see the figure below.

 

rozcestník03

If we keep the naming conventions in the given form, the links between the tables will automatically be created in the form we need.

Visual selection and settings

We then tried to arrange the reports in a grid in a matrix table. The test was as follows: we entered the Report Group and Row ID in the rows of the matrix and the Col ID in the columns. We inserted the report name in the values (where the first value is automatically displayed). The test was successful, as you can see below.

rozcestník04

If we add an icon in base64 format to the data source (field Icon value base with prefix "data:image/jpeg;base64" and column data category set to "image URL"), the output might look like this.

rozcestník05

Now the solution looks much better. But we still have a few steps to go.

Interactive report Portal links

At the moment, we are mainly interested in whether it will be possible to set a clickable link for the image and the name of the report. We have therefore prepared a new column with the URL to the given report in the source data. Any valid URL will do for testing, see the example. It is important not to forget to set the data category to "Web URL".

rozcestník06

When we set the URL to both the image and the report name, we find that the report name is underlined, which is not appropriate for our Report Portal. Unfortunately the option to remove the underline is not available. So we looked for other options to display the image with the text, ideally with advanced styling options.

Report Portal icons

Next we focused on the icon. We tried to add it in the form of SVG (Scalable Vector Graphic). The aim was to add a valid SVG definition to the table. The main reason for this was that the icons could be managed centrally in the mapping table.

rozcestník07

Another reason was to be able to control the logic of the colour change and also the necessary prefix "data:image/svg+xml;utf8" in the DAX metric itself. We also need to set the data category to "image URL" for the finished metric.

rozcestník08

At this point we returned to report names. We focused on the SVG image definition and added the report name directly to it. And to make it consistent, we set it directly in the DAX metric, where the foreignObject definition is added to the SVG before the closing</svg> tag.

<foreignObject x=’-50%’ y=’110%’ width=’200%’ height=’50%’ style=’text-align:center’>

<div xmlns='http://www.w3.org/1999/xhtml'>Název reportu</div>

<foreignObject>

This also ensures native wrapping of longer report names. You can also set a uniform colour for the text to match the colour of the icon. This was not desirable in our case due to the colour spectrum of the icons. The result can be seen in the image below.

rozcestník09

Now, when we set the web URL, it will be possible to click on both the image and the title, and the click-through will work in both cases.

rozcestník10

rozcestník09

We then focused on the colour of the icon according to the group of reports. To do this, we added an icon colour column to the source table and inserted the hex code of the appropriate colour.

rozcestník12

The next step was to modify the metric and replace the default colour of all icons with the colour filled in the control table.

rozcestník13

The result already looks very nice. All you have to do is add the correct URL to your reports.

Then we started testing. We tested several reports to make sure that the click-throughs were working and that we were really getting to the right report. Then came more advanced scenarios.

 

What happens if a user does not have permissions for one of the report areas? If the user only has access to reports in the Management, Operations and Sales areas, they will see the view shown below.

rozcestník14

We see that the behaviour is fine.

However, if we look at the second scenario, where the user should not have permissions for some reports in the given group, the result does not look good. This can be seen in the picture below.

rozcestník15

By filtering out some reports, whitespaces appear and group affiliations are no longer visible. This is not the behaviour we expect. The goal is for reports to be ordered from left to right, top to bottom, under all circumstances. All that remains is to dynamically calculate the X and Y position for the location of the reports after filtering the displayed set of reports.

To achieve this behaviour, we completely redesigned the matrix. We deleted the Col and Row table references and removed the Row_ID and Col_ID columns from the source file. In the new solution, the X and Y positions are calculated dynamically in the virtual table using the DAX metric. The Y position is calculated as follows: after applying the RANKX function at the row level, we number the remaining reports in each group and divide the number by the maximum number of columns. From the result, we keep only the whole number, i.e. the number before the decimal point, and we add 1, otherwise the numbering would start from 0. The calculation of the X position is similar, except that the numbering using the RANKX function is not only related to the group of reports, but also to the row number that we calculated in the previous step. The result is the dynamic assignment of the X and Y position to each report after each filtering of the reports, and therefore the rearrangement of the layout of the icons in the matrix table.

The result is the desired behaviour, as you can see in the example.

.

rozcestník16

It is important to note that the URL must be calculated in the same way for each position (and with the same numbering logic as for the icons, so that the URL does not lead to a different report than the one indicated in the title). For this purpose, it is also necessary to specifically prepare a similar metric that returns a URL instead of an image.

The advantage of this solution is that you can freely change the layout of the icons within the grid. It is therefore very easy to arrange the icons in a 3x3, 4x2, 5x1, etc. structure.

For example, 2x4

rozcestník17

Or 3x3 (the third row is only displayed if the previous two are full and if there is a report that can be placed in the third row)

rozcestník18

 

Or 7x2 (the second row will never appear in this case because there are no more than seven reports in each group).

rozcestník19

It is also possible to add a metric that automatically calculates the number of groups of reports that fit into a visual underneath each other when the grid is set up X to Y. Then it is possible to display reports in two matrix visuals side by side, for example like this:

rozcestník20

This is the setting we consider optimal from a design point of view. We have ensured that the number of report rows is calculated dynamically according to the maximum number of reports in a given group. It must not happen that we are missing a window in the final grid for the report. The report prepared in this way can then be combined with the logic of filtering reports according to user permissions for reports or groups of reports.

A few more tips

- When preparing the URL in the control table, it is possible to add URL parameters that can be used to achieve different settings of the browser window. For example, you can hide some Power BI Service control panels that are not needed by the user. Therefore, it is advisable to consider which URL address to prepare in the source data. The embedded URL mentioned above is easily accessible in the Power BI Service. Simply open the relevant report, click File > Insert Report > Web or Portal > and copy the link. However, whether you use this embedded URL or a classic URL in the source data, the reports will open in a new window, which is very handy for returning to the Report Portal. Then, when you deploy the Report Portal into production, consider adding a button to each report that links to this Report Portal. This small detail will take your entire solution one step further in terms of a pleasant user experience.

- If you are using live connection / direct query and import mode at the same time, a small icon next to each report with the symbol of a specific connection could be useful.

- At the same time, it is possible to ensure that a red dot lights up in the bottom corner of those reports for which the last refresh failed when viewed by the administrator (line level security setting). This is particularly useful if the source is from multiple datasets with separately set refreshes.

Conclusion

We have shown that with a little imagination, you can achieve some interesting functionality in Power BI and create your own navigation page with the possibility of further expansion and customisation. Do you like the result? Would you use it in your business? Do you want to create a similar Report Portal but are stuck in one of the steps? Or do you want to provide one of the DAX metrics? Contact us (by e-mail).

Do you have an interesting topic that you would like to implement, but it does not seem possible in Power BI? Or are you missing something in the reports, is there something that does not suit you or does not have enough setting options? Send us your ideas and suggestions and you might find a solution in our next post.

Author: Tomáš Němeček
Power BI department
tomas.nemecek@dolphinconsulting.cz

Tomáš

Zpět na výpis rubriky