Forum Discussion

BA123456's avatar
BA123456
Frequent Visitor
1 year ago
Solved

Scale error in bar chart

Hey,

 

can someone help me fix the scale of the bar chart (s. below). Depending on the categories I´m selecting, the scale of the bar chart is off.

 

First example

Second example with each value

The value of the y-axis is on auto

About 80% of the categories are fine, like in this example:

 

Please let me know, if you need further information. Though, I can´t share the file.

 

Thank you 🙂

  • Hi BA123456  , for Y axis, if you keep it as Auto, then Power BI will plot the axis which may not be always based on your max value. To resolve this, you need to create a measure.For this, I took a small dataset like below:

     

    Then created a measure:

    Max Val per Country =
    VAR _max = SUMMARIZE(Chart, Chart[Period].[Month], "Max_Val", SUM(Chart[Volume]))
    RETURN
    MAXX(_max, [Max_Val]) * 1.2
     
    What this measure does is, based on your slicer selection, it first group by months and then identifies the max value for all the given months. I think for your case, you can replace Chart[Period].Month with your year value. Then once the Max value we have, then simply multiply that with 1.2 factor to make the max level 120% of max value. You may change this factor based on your data.
     
    After that, add that measure in y-axis max value.
     

     

     

     


    If this helps to resolve your problem then please mark it as solution.

    Thanks - Samrat

     

     

    BA123456

  • Hi BA123456  use the measure and guideline suggested by samratpbi

    Only ensure 2 decimal places for values, since your values are less than 1 million. 

     

    Thanks 

4 Replies

  • Hi BA123456  , for Y axis, if you keep it as Auto, then Power BI will plot the axis which may not be always based on your max value. To resolve this, you need to create a measure.For this, I took a small dataset like below:

     

    Then created a measure:

    Max Val per Country =
    VAR _max = SUMMARIZE(Chart, Chart[Period].[Month], "Max_Val", SUM(Chart[Volume]))
    RETURN
    MAXX(_max, [Max_Val]) * 1.2
     
    What this measure does is, based on your slicer selection, it first group by months and then identifies the max value for all the given months. I think for your case, you can replace Chart[Period].Month with your year value. Then once the Max value we have, then simply multiply that with 1.2 factor to make the max level 120% of max value. You may change this factor based on your data.
     
    After that, add that measure in y-axis max value.
     

     

     

     


    If this helps to resolve your problem then please mark it as solution.

    Thanks - Samrat

     

     

    BA123456

    • BA123456's avatar
      BA123456
      Frequent Visitor

      Hey Samrat, thanks for the fast reply 🤗

      Unfortunately, it doesn't seem to be working. I think the unit displayed could be causing the problem. Should your solution above already bypass this problem? Example below

       

      Units in million

      Units in thousand

       

       

       

  • Royel's avatar
    Royel
    Icon for Super User rankSuper User

    Hi BA123456  use the measure and guideline suggested by samratpbi

    Only ensure 2 decimal places for values, since your values are less than 1 million. 

     

    Thanks