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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Saibal_78
Helper I
Helper I

Auto resize columns width based on no. of columns selected in matrix

Hi All,

I am working on a report where I want auto adjust columns width in a matrix based on no. columns present in the matrix which is in turn coming from a date range slicer. This is similar feature which is there in clustered column chart, not sure the same can be replicated in matrix.

 

Below measure helps me create columns with identical width, but as soon as I add new date in the range it doesn't refresh which is obvious as auto-size width is turned off. 

 

Col_width =
Var selected_months = ALLSELECTED('Date'[Date])
Var selected_months_count = CONVERT(CALCULATE(DISTINCTCOUNT('Date'[Period]), 'Date'[Date] in selected_months),INTEGER)
Var chart_length = CONVERT(115,INTEGER)
RETURN
REPT("0",chart_length/selected_months_count)
 
This is what I get using this measure, which I dont want. I want to get the matrix table behave the way below clustered chart is behaving.

Saibal_78_2-1717855541473.pngSaibal_78_1-1717855372647.png

I uderstand the purpose of above measure is different, however want to know if this can be somehow achieved. Any suggestion will be highly appreciated.

Thanks

 

2 REPLIES 2
rajendraongole1
Super User
Super User

Hi @Saibal_78 - Unfortunately, the matrix visualization in Power BI doesn't currently support dynamic column width adjustments similar to the clustered column chart.

 

similar workaround we can do it by combination of calculated columns and conditional formatting to simulate dynamic column widths.

create a new calculated column :

Col_Width =
VAR Selected_Months = ALLSELECTED('Date'[Date])
VAR Selected_Months_Count = CALCULATE(DISTINCTCOUNT('Date'[Period]), 'Date'[Date] IN Selected_Months)
RETURN
Selected_Months_Count * 10 // Adjust the multiplier to control the width

 

use this calculated colum based conditional formatting and select the font size to influence the width of the column directly.

 

Try the above approach and let know.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Hi 

Thanke for the reply, not sure if I understood your last sentence, do you mean conditional formatting of the value field as shown in below screen shot? what exact steps should I follow?

 

Saibal_78_0-1717991378892.png

 

Thanks

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.