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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RaMiRo87
Frequent Visitor

Dynamic y-axis bar chart - prevent data labels from overlapping

Hi folks,

 

I have a problem with overlapping data labels in my bar charts and need urgently help! 

My problem is certainly of a rather simple nature, but I have not yet been able to find a 100% suitable topic in the community.

 

The data labels are no longer displayed above the respective column for the maximum values, but are either written in the column or half and half. Both variants are known to be illegible.

 

One of my bar charts contains the sales regions [Legal Entity] on the X-axis and the incoming orders [Incoming Orders] on the Y-axis. The bar charts are filtered by a period slicer (MTD, YTD etc.). The column [Legal Entity] and [Incoming Orders] both originate from the fact table 'fcontrolling'.

 

Now I would like that when I select different periods via my slicer, the scales of the column charts are dynamically adjusted to the highest value within this filtered period and there is always a little whitespace above and below the columns so that there is enough space for the data labels.

 

Many thanks for your help in advance!

 

Best regards
Ramirez

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@RaMiRo87 , Ideally it should adjust , if you are using field parameters to switch measures

 

else create min and max like

 

min = minx(Values([Legal Enity), [Your measure] )*.9

 

max = maxx(Values([Legal Enity), [Your measure] )* 1.1

 

 

and use them in Y-axis Min/Max values  

View solution in original post

v-jianpeng-msft
Community Support
Community Support

Hi, @RaMiRo87 

You can define a measure of the maximum value of the Y-axis, which depends on the field or measure used by your Y-axis. I created a sample as follows:

vjianpengmsft_0-1713839974298.png

vjianpengmsft_1-1713840003441.png

At this point, 900 is inside the column, and here are the steps to adjust it:

Visual>>Y-axis>>Turn off Logarithmic scale

vjianpengmsft_2-1713840133462.png

Create a measure based on the field or measure you use on the Y-axis. The purpose of the entire maximum value is to allow the maximum value to be displayed on the Y axis higher than your actual maximum value.

Max y-axis = [Sum of sales]*1.1 

Click Maximum fx

vjianpengmsft_3-1713840413624.png

vjianpengmsft_4-1713840433271.png

vjianpengmsft_5-1713840496559.png

In your case, your DAX expression should look something like this:

MaxValue =
CALCULATE (
    MAX ( 'fcontrolling'[Incoming Orders] ),
    ALLSELECTED ( 'fcontrolling' )
) * 1.1

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
v-jianpeng-msft
Community Support
Community Support

Hi, @RaMiRo87 

You can define a measure of the maximum value of the Y-axis, which depends on the field or measure used by your Y-axis. I created a sample as follows:

vjianpengmsft_0-1713839974298.png

vjianpengmsft_1-1713840003441.png

At this point, 900 is inside the column, and here are the steps to adjust it:

Visual>>Y-axis>>Turn off Logarithmic scale

vjianpengmsft_2-1713840133462.png

Create a measure based on the field or measure you use on the Y-axis. The purpose of the entire maximum value is to allow the maximum value to be displayed on the Y axis higher than your actual maximum value.

Max y-axis = [Sum of sales]*1.1 

Click Maximum fx

vjianpengmsft_3-1713840413624.png

vjianpengmsft_4-1713840433271.png

vjianpengmsft_5-1713840496559.png

In your case, your DAX expression should look something like this:

MaxValue =
CALCULATE (
    MAX ( 'fcontrolling'[Incoming Orders] ),
    ALLSELECTED ( 'fcontrolling' )
) * 1.1

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-jianpeng-msft,

 

thank you very very much for the detailled description! 

 

Especially your measure was nice to compare it to my current solution. 🙂

 

Thanks a lot!

amitchandak
Super User
Super User

@RaMiRo87 , Ideally it should adjust , if you are using field parameters to switch measures

 

else create min and max like

 

min = minx(Values([Legal Enity), [Your measure] )*.9

 

max = maxx(Values([Legal Enity), [Your measure] )* 1.1

 

 

and use them in Y-axis Min/Max values  

Hi @amitchandak,

 

shoul do the trick. Thank you very much for your quick response! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.