Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Bar Chart Labels with Hierarchical Axis

Hi,

I'm trying to build a bar chart with a four-level hierarchical Y-axis, however it does seem possible to format the labels in a way in which they are usable.  The default behavior results in this, which is pretty unusable:

I would like to not show repeated items and have a little space beteen labels so they don't run together, ideally somthing like this:

Is there any way to do this?

  • Hi Anonymous ,

     

    I have a workaround:

    First create an index column in query editor;

    Then create 3 columns as below:

    _Axis 1 = 
    var _pre=CALCULATE(MAX('Table'[Axis 1]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 1]=_pre,"",'Table'[Axis 1])
    _Axis 2 = 
    var _pre=CALCULATE(MAX('Table'[Axis 2]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 2]=_pre,"",'Table'[Axis 2])
    _Axis 3 = 
    var _pre=CALCULATE(MAX('Table'[Axis 3]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 3]=_pre,"",'Table'[Axis 3])

    And you will see:

    Then select column "Great-Grandchild(Axis 4)">sort by "Index";

    Remember to first put Axis 4 as the Axis in bar chart,then add the other 3 Axis,as it will keep the order of Axis 4.

    Finally you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

2 Replies

  • Hey Anonymous ,

     

    at the current moment this feature is not support for the default bar charts like Stacked or Clustered bar chart. You just can achieve this by using one of the column charts, like in the picture below:

    Maybe, this will work for you as well.

     

    Regards,

    Tom

  • v-kelly-msft's avatar
    v-kelly-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    I have a workaround:

    First create an index column in query editor;

    Then create 3 columns as below:

    _Axis 1 = 
    var _pre=CALCULATE(MAX('Table'[Axis 1]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 1]=_pre,"",'Table'[Axis 1])
    _Axis 2 = 
    var _pre=CALCULATE(MAX('Table'[Axis 2]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 2]=_pre,"",'Table'[Axis 2])
    _Axis 3 = 
    var _pre=CALCULATE(MAX('Table'[Axis 3]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
    Return
    IF('Table'[Axis 3]=_pre,"",'Table'[Axis 3])

    And you will see:

    Then select column "Great-Grandchild(Axis 4)">sort by "Index";

    Remember to first put Axis 4 as the Axis in bar chart,then add the other 3 Axis,as it will keep the order of Axis 4.

    Finally you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!