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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.