Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

barritown

Custom Captions on Axis X

Does it happen to you that you are not quite content how Power BI manages things for you on a dashboard and you want to correct them but cannot find the right settings because they just haven’t been invented yet?

 

For example, you are a guy who adores right angles but the stubborn Power BI rotates captions on the X axis of your bar chart using the angle of 45 degrees because they are too lengthy.

 

barritown_0-1698333482679.png

 

In addition, it doesn’t allow you to move them up when you have only negative values.

 

barritown_1-1698333523875.png

 

What a pity. But thinking out of box you will always achieve what you want.

 

First of all, let’s remove the standard captions by switching off the X-axis tumbler.

 

barritown_0-1698333970263.png

 

Having done that, let’s reinvent those captions in our own design.

 

The first building block would be a set of Y-axis coordinates where our new captions are to be placed. Understanding that the names of the trenches are quite long, we would want to place our captions in a saw-shaped manner so we carefully choose these coordinates and carefully pack them into an additional column (or an additional table if you like).

 

barritown_1-1698334053134.png

 

Then we must change the visual type from the mere Stacked column chart to Line and stacked column chart.

 

barritown_2-1698334092001.png

 

Then we add our Dummy line on the visual and see the picture below (despite it all looks worse than on the initial picture, we are pretty close to our goal).

 

barritown_3-1698334135547.png

 

You would also want to adjust manually (or using some formula) the maximum (or minimum) of Y-axis so the captions we are about to add fit nicely. This step may require some iterations to reach the necessary level of perfection.

 

barritown_4-1698334165375.png

 

Now we have to make the line we added earlier invisible by setting the width of its strokes to 0 px.

 

barritown_5-1698334196267.png

 

The last step is to enable data lables for this hidden line and adjust them in the right way.

 

barritown_6-1698334227947.png

 

Here is the final result.

 

barritown_7-1698334249190.png

 

The guy who adores right angles will be satisfied, won’t he?

 

Should you understand Russian, you can find this article in the form of a video in my vlog on YouTube here.

 

The dashboard, with the help of which I explained this trick, is attached. Feel free to download it.

 

Cheers,

Alexander