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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
andyor
Resolver I
Resolver I

Making font wrap work correctly for matrix column headers?

I have some column headers as such. 

 

andyor_1-1675486279344.png

 

 

If I add on some extra text to the column header field it just makes the columns go longer to accomodate the new text

 

andyor_2-1675486330266.png

 

But what I want is for the column to go wider, not longer. So the text wraps around and goes over 2 lines consinstently across each column. 

 

andyor_0-1675486228610.png

 

The only way it looks like I can curently do this is to manually move each column header into place, with the 'wrap text' option enabled. But this is not feasible as I have maybe 200 column headers, which grows by 1 dynamically each week. 

 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @andyor ,

 

as you said by default you have to do that manually.

However there are a few hacks. I think the best approach is the following:

The ultimate hack to set column widths in a matrix | Esbrina (esbrina-ba.com)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

View solution in original post

2 REPLIES 2
selimovd
Super User
Super User

Hey @andyor ,

 

as you said by default you have to do that manually.

However there are a few hacks. I think the best approach is the following:

The ultimate hack to set column widths in a matrix | Esbrina (esbrina-ba.com)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Hi @selimovd this link seems great in theory but it doesn't explain how to do the steps it shows. 

 

I tried adding the below as a new column but there isn't a column width table or column in my dataset, so that can't work. The solution also talks about calculation group column, alternate values etc .

 

When I download the pbix file there are 2 extra tables - Column Width and Spacing. They both have an 'Ordinal' attached and there's no mention of this in the solution. The other table is 'Sales', and there are no new columns or measures here either. 

 

Where are we entering code like the below? 

 

5 (format string expression) =
VAR currentValue =
    SELECTEDMEASURE ()
VAR currentLength =
    LEN ( CONVERT ( currentValue, STRING ) )
VAR selectedLength =
    CONVERT (
        SELECTEDVALUE ( 'Column Width'[Column Width], currentLength ),
        INTEGER
    )
VAR extraSpaces =
    IF ( selectedLength > currentLength, selectedLength - currentLength, 0 )
VAR prefix =
    REPT ( UNICHAR ( 0160 ), extraSpaces )
RETURN
    """" & prefix & """"
        & SELECTEDMEASUREFORMATSTRING ()

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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