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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
calloni
Helper I
Helper I

Fixed Width column based on largest Label

Hello,

 

I am trying to reproduce this easy to build Tableau Chart in Power BI but it is harder than it looks:

 

calloni_0-1720795696875.png

 

The closest that I got is this using the Matrix visual:

 

calloni_1-1720795747673.png

 

The main pain points with this solution are:

 

1 - The width of columns are not the same as it depends on the lenght of the label for each year

 

2 - The lenght of the chart itself does not adjust to the max  lenght of the visual. This creates a problem when I have many more years and creates an unecessary horizontal scroll bar.

 

Alternative options that I already tried include using a stacked bar chart (that fixed issue 2 as the bars adjusted to lenght of the visual card) and I used a fixed value 1 for the width of each year, but then no way to setup the colors based on the Grade column: here is how it looks:

calloni_2-1720796094189.png

 

 

Here is the sample that I used for this chart. 

 

Operation NumberYearGrade
1232014ALERT
1232015PROBLEM
1232016PROBLEM
1232017PROBLEM
1232018PROBLEM
1232019ALERT
1232020PROBLEM

 

If you have any ideas I would love to hear.

 

Thanks in advance

Rodrigo

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @calloni 
Matrix is the way 🙂
According to the columns width,
to "freeze" them, you can apply these steps:
1. Create a measure 

rep = REPT("X",9)
9 is the length of the longest string ("problem")+2
2. grab it to the values :
Ritaf1983_0-1720926641266.png

3. switch the values to rows:

Ritaf1983_1-1720926742362.png

4. switch on auto size column width

Ritaf1983_2-1720926829579.png

5. 4. switch off auto size column width

Ritaf1983_3-1720926884836.png

6. remove rep measure

Result :

Ritaf1983_4-1720926991300.pngRitaf1983_5-1720927010196.png

 

According to the responsivity of the matrix, you should plan the maximum width +/-, there are no other solutions

Ritaf1983_6-1720927376731.png

 

pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

2 REPLIES 2
calloni
Helper I
Helper I

Thanks for the trick... I hope it is scalable for years to come (what will happen when a new year that wasn't fixed is added to the table?)

 

I guess I will have to wait and see 🙂

 

Rodrigo

Ritaf1983
Super User
Super User

Hi @calloni 
Matrix is the way 🙂
According to the columns width,
to "freeze" them, you can apply these steps:
1. Create a measure 

rep = REPT("X",9)
9 is the length of the longest string ("problem")+2
2. grab it to the values :
Ritaf1983_0-1720926641266.png

3. switch the values to rows:

Ritaf1983_1-1720926742362.png

4. switch on auto size column width

Ritaf1983_2-1720926829579.png

5. 4. switch off auto size column width

Ritaf1983_3-1720926884836.png

6. remove rep measure

Result :

Ritaf1983_4-1720926991300.pngRitaf1983_5-1720927010196.png

 

According to the responsivity of the matrix, you should plan the maximum width +/-, there are no other solutions

Ritaf1983_6-1720927376731.png

 

pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors