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
Mendel
Frequent Visitor

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:

hier_bar1.JPG

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:

hier_bar2.JPG

Is there any way to do this?

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Mendel ,

 

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:

v-kelly-msft_0-1607653647705.png

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:

v-kelly-msft_1-1607653775651.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @Mendel ,

 

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:

v-kelly-msft_0-1607653647705.png

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:

v-kelly-msft_1-1607653775651.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

TomMartens
Super User
Super User

Hey @Mendel ,

 

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:

TomMartens_0-1607456169885.png

Maybe, this will work for you as well.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.