fbpx
Menu Close

How to force your visual to be always on top?

Sometimes Power BI lacks fairly simple options. It would seem that there is nothing easier than, for example, adding the ability to align values ​​in Cards in the UI. Or to remove an incomprehensible restriction of 40 pixels (btw, why exactly 40? Why not 33, not 20, or at least 42?) when manually entering visualization properties. However, no – for some reason, the guys from Microsoft rarely go down to such a “small” level of improvement.

One of these options, in my opinion, is the “always on top” option for visualizations. What do I mean? This:

Shroedinger’s slicer

Even if our slicer (chart, table, map – it doesn’t matter) in the default state is in the foreground, any selected element will always overlap it, even if it initially was on the back.

I don’t quite understand what the developer was guided by coding such behavior, but… we can get around this. Moreover, even in multiple ways. So, let’s go!

Oh, yes. You can find the source file here, and open the published report here.

Solution #1. Classic

I’ve been using this trick for almost two years now, and it is quite suitable for the vast majority of cases.
Most of the time, our problem boils down to the fact that the user accidentally clicks a shape on the background, which serves as the basis for the main chart. As a result, the graph goes under the selected figure, and the user becomes upset:

Just don’t touch the white shape… We warned you

The solution is simple, elegant, and was generally described by powerbi.tips team in this video. But the author of the video made several unnecessary movements.

The essence of the solution is that we enable the “Action” option for our background shape. Then, from the drop-down list, we select the “Bookmark” option. After that, please check that the “None” option is selected, that is, none of the bookmarks in the report. That’s all.

After the publication of the report, the user will not be able to select a shape, because this figure has become a button. The graph is in place, the user is satisfied. For the best UX, it’s also good to write a nice tooltip when hovering over a shape, instead of “Click here to …”

Completely useless big white button

The only drawback I noticed in this solution is that if the shape has a border (which is required if you want beautifully rounded corners), and if the user clicks somewhere near it, then the figure will appear in the foreground. Very unlikely, but still unpleasant. And we will fix this in solution #3, a little bit later.

And, obviously, this solution works only with shapes, images, and buttons – we need the “Action” option to make it work.

Solution #2. Grouping

I came to this solution by accident, working on the COVID dashboard from the previous article.
Oddly enough, the grouping of visualizations carries not only an aesthetic function. Look what a beauty:

It just works

All that is needed is to make the grouping “with itself” for the diagram below. That is, we group it with any other element on the sheet, and then physically delete this other element (using the Selection menu and the Delete key). Sometimes Power BI generates an error – I did not see any bugs because of it, but just in case, please save a duplicate of the file.

As a result, we get a group of one visual, which – suddenly! – does not overlap the visual element in front of it when selected.

We can send our report to the Power BI Service and be totally happy. With this approach, the slicer hides behind the chart only when you turn on the focus mode or expand the chart to full screen, and this behavior seems fairly logical to me.

However, there is a significant drawback to this solution. Power BI for some unknown reason draws a frame around the grouped elements, even in reading mode. Here is such a one:

Border = clutter

This usually drives your users a little bit crazy. And we will surely fix it.

Solution #3. Perfectionism

UPD 2020-07-26:
Looks like Microsoft guys fixed this “hovering frame” bug/feature, so we don’t really need to use this solution. However, if you still want to solve the border issue from Solution #1 – please, don’t stop reading

Groups have visible boundaries. This is bad. But we can cover them with other visual elements, and that’s good.
Yes, we are cluttering up our report. Yes, we must do that for each group created in Solution #2. But the end-user is not concerned about all this stuff, believe me.

So, we will close the pop-up borders with other visualizations – for example, the lines.
There is no special trick here – you simply lay the figure on so that the line is exactly above the border of the group. I personally used the Line shape with a frame width of 20 pixels and a line thickness of 3 pixels. And, of course, do not forget about the Rotation property to create a horizontal line, and turn off the visual headers, please.

And don’t forget to change the color

Returning to Solution #1, your lines (more precisely, the transparent frames around them) may well cover the borders of the shapes in the background, making it impossible for the user to click on them.

In general, the final solution looks like this:

Yes, it’s not as simple as “click another checkbox in the menu”, and it requires a few additional movements and attention to each pixel on the screen, but the result is worth it. Do you agree?

4 Comments

  1. Daniil Maslyuk

    Maks, great post. I’ll admit it — I didn’t know about the techniques you described 🙂 Perhaps #3 now doesn’t need the extra line visuals as borders don’t appear in reading view in Power BI service anymore?

    • Maks

      Yes, you are right, Daniil!
      Something tells me that you were partially involved in this update from Microsoft 🙂

  2. Steven Taub

    Hi, thanks for these tips, I’m saving them for future use.

    Question, when i click on a visual that’s lower than the object on top, it automatically becomes front and center. How do I prevent a visual from becoming front and center, so that when I click on it, it doesn’t appear on top of another object?

Leave a Reply

Your email address will not be published. Required fields are marked *