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
zzakir
Helper II
Helper II

Format part of Dynamic Title or add a line break

Hello,

I have a Dax that I use for Dynamic title of my charts (Year and Months are dynamic based on applied filters):
Top 5 spends for 2021 (Jan, Feb, Mar, Apr...)

Can I format it so that only the months are italicized:
Top 5 spends for 2021 (Jan, Feb, Mar, Apr...)

 

or

 

have a line break so the title is two lines:
Top 5 spends for 2021
(Jan, Feb, Mar, Apr...)

1 ACCEPTED SOLUTION

After discussing this issue with @HashamNiaz, it seems like when using dynamic titles with a line break using unichar(10) in your title DAX, you need to turn the "word wrap" feature OFF under title settings for line break to work. However, with the "word wrap" feature OFF (Matrix and Table visuals), 2nd line of the title gets overlapped by the column headers. 

 

If Word Wrap is left ON and your title runs out of the space on first line, Power BI pushes remaining test to the 2nd line which is not overlapped by the title.

View solution in original post

10 REPLIES 10
HashamNiaz
Solution Sage
Solution Sage

Hi @zzakir !

 

Surprisingly, i can see the opposite while i am using matrix visual with Power BI Desktop Version: 2.92.1067.0 64-bit (April 2021)

Here is my measure DAX;

 

 

 

Title = "Test Year: " & SELECTEDVALUE('Calendar'[Date].[Year]) &  Unichar(10) & "Test Month: " & SELECTEDVALUE('Calendar'[Date].[Month])

 

 

 

WordWrapOffWordWrapOffWordWrapOnWordWrapOn

 

Agreed with you, Row Padding doesn't make any change. We have to either choose single line Title or multi-line with cutover.

 

Regards,

Hasham

So it works for Matrix visual but not the table? Can you change your visual to table and see if you still get the desired result? I just want to make sure that I am not missing something here. Also in your example where you have Word Wrap off in Matrix, it seems like if you left align your title it will overlap with the Matrix's column headers.

Hi @zzakir !

 

The effect is same for both table & matrix visual. In my visual you are oly able to see title because i have enough free space of chart area & i make title alignment to center.

 

Regards,

Hasham

HashamNiaz
Solution Sage
Solution Sage

Hi !

You can add a line break using special character UNICHAR(10), see below article for reference;

DAX – How to get a line break in a DAX measure for Labels or Titles in a Power BI report? 

 

Regards,

Hasham

I was able to bring it down to the 2nd line using Unichar(10) but in the table visual, 2nd line of the title gets mostly overlapped by the table header (see image below). Please also note that it worked perfectly fine for bar chart... Is there something in the setting of table that I need to change?

 

PD Q.PNG

 

 

 

 

PD Q 2.PNG

After discussing this issue with @HashamNiaz, it seems like when using dynamic titles with a line break using unichar(10) in your title DAX, you need to turn the "word wrap" feature OFF under title settings for line break to work. However, with the "word wrap" feature OFF (Matrix and Table visuals), 2nd line of the title gets overlapped by the column headers. 

 

If Word Wrap is left ON and your title runs out of the space on first line, Power BI pushes remaining test to the 2nd line which is not overlapped by the title.

Hi @zzakir !

There are 2 things to it, you can turn on Word Wrap for title which will eventually try to fit the title in single line.

 

Secondly you can increase the row padding from Grid property, this will increase the padding between all rows and also make room for title to be visible in 2 lines while title word wrap is set to off.

 

Regards,

Hasham

I had the Word Wrap for title on because I wanted the months to show up on 2nd line since first line doesn't have too much space because of the title prefix.

I tried increasing the padding but it only increases the padding for rows with data and not for the title row.

Hi @zzakir !

As i suggested please turn off Word wrap for title and then increase the Row adding, it will move tables rows down. Which will cause your title to show clearly.

 

Regards,

Hasham

I have images with both Word Wrap ON and increased padding which didn't help. The 2nd line is still getting cut off.

Wordwrap ON and extra padding on grid.PNG

 

AND

 

Word Wrap OFF and increased padding... (notice I lose the line break between year and month)

 

Wordwrap OFF and extra padding on grid.PNG

 

It seems like there is no solution to this one. I will just need to keep Word Wrap ON, no padding and just forget about having a line break between year and months.

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.