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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Is it possible to adjust the matrix column width using DAX?

I want to create a column that if it is found to be null the width of the column will go to zero and essentially disappear. If the column is not null then it will set the column width to a certain size and fill in the column with the proper values. I am trying to use this as a way to kind of have a work around in having dynamic columns that change based off of slicer selection. Thanks!

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

Hi @Anonymous ,

 

There is no such an visibility option that supports to conditionally hide/show column in Matrix. For such needs, you may consider voting for similar ideas in Power BI Ideas.

Links of similar ideas: https://ideas.powerbi.com/ideas/search-ideas/?q=hide%20column%20in%20matrix and https://ideas.powerbi.com/ideas/idea/?ideaid=5f080970-9ddc-4d8b-8e51-8519eef2ce60.

 

If you want the width of the column dynamically change according to the length of its values, you need enable Auto-size column width firstly.

vcazhengmsft_0-1649171999158.png

 

Then currently, one option is to hide or show the values in the column by creating measures, but It depends how you create your matrix visual.

Here are the sample data used.

vcazhengmsft_1-1649171999159.png

 

If use Project as Rows and status as Columns of Matrix visual, and take a Measure that do calculation for it as Values, then Matrix visual will look like the following screenshot.

vcazhengmsft_2-1649171999161.png

 

status_ =
VAR count_selected =
    CALCULATE (
        COUNTBLANK ( 'Table'[status] ),
        'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
    )
VAR count_selected_ =
    CALCULATE (
        COUNT ( 'Table'[status] ),
        'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
    )
RETURN
    IF ( count_selected = count_selected_, BLANK (), MAX ( 'Table'[status] ) )

 

vcazhengmsft_3-1649171999162.png

 

vcazhengmsft_4-1649171999163.png

 

vcazhengmsft_5-1649171999163.png

 

But if you create Matrix with Project as Rows and with no field as Column, column headers are still appeared even there is no data.

vcazhengmsft_6-1649171999163.png

 

vcazhengmsft_7-1649171999164.png

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous ,

 

There is no such an visibility option that supports to conditionally hide/show column in Matrix. For such needs, you may consider voting for similar ideas in Power BI Ideas.

Links of similar ideas: https://ideas.powerbi.com/ideas/search-ideas/?q=hide%20column%20in%20matrix and https://ideas.powerbi.com/ideas/idea/?ideaid=5f080970-9ddc-4d8b-8e51-8519eef2ce60.

 

If you want the width of the column dynamically change according to the length of its values, you need enable Auto-size column width firstly.

vcazhengmsft_0-1649171999158.png

 

Then currently, one option is to hide or show the values in the column by creating measures, but It depends how you create your matrix visual.

Here are the sample data used.

vcazhengmsft_1-1649171999159.png

 

If use Project as Rows and status as Columns of Matrix visual, and take a Measure that do calculation for it as Values, then Matrix visual will look like the following screenshot.

vcazhengmsft_2-1649171999161.png

 

status_ =
VAR count_selected =
    CALCULATE (
        COUNTBLANK ( 'Table'[status] ),
        'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
    )
VAR count_selected_ =
    CALCULATE (
        COUNT ( 'Table'[status] ),
        'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
    )
RETURN
    IF ( count_selected = count_selected_, BLANK (), MAX ( 'Table'[status] ) )

 

vcazhengmsft_3-1649171999162.png

 

vcazhengmsft_4-1649171999163.png

 

vcazhengmsft_5-1649171999163.png

 

But if you create Matrix with Project as Rows and with no field as Column, column headers are still appeared even there is no data.

vcazhengmsft_6-1649171999163.png

 

vcazhengmsft_7-1649171999164.png

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

tamerj1
Super User
Super User

@Anonymous 

Can you provide more details about your measures, data model, your matrix visual and the slicers. Maybe we can find a workaround on your workaround. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.