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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
StephenF
Responsive Resident
Responsive Resident

Dynamic font size in a table visuals text values

I have a table that displays text strings in the body, ie in the "values". These values are typical single or pairs of words, "dance", "Crime", " "New Age", "Period Drama"

 

Sometimes the strings are longer words, and you cant see the whole word.

 

Rather than use wordwrap, I want to make the font dynamic so say a 3 letter word in a cell would appear larger in font size then a 8 letter word. Can font size in a table be made dynamic?

 

 

2 REPLIES 2
v-zhouwen-msft
Community Support
Community Support

Hi @TomMartens ,thanks for the quick reply, I'll add further.

Hi @StephenF ,

Perhaps you can use the Html visual object.

vzhouwenmsft_0-1715915188731.png

The Table data is shown below:

vzhouwenmsft_0-1716258009893.png

1.Use the following DAX expression to create a table

 

 

Table = ADDCOLUMNS(SUMMARIZE('Sales_Table','Sales_Table'[Product],"Total",SUM(Sales_Table[Amount])),"Length",LEN([Product]))

 

 

 

 

vzhouwenmsft_1-1716258072410.png

2.Use the following DAX expression to create a column in 'Table'

 

 

Column = 
VAR _a = SWITCH(TRUE(),
[Length] <=5,"5",
[Length] >5 && [Length] <=14,"3",
[Length] >14,"1"
)
VAR _average = CALCULATE(AVERAGE('Table'[Total]),ALL('Table'))
VAR _b = SWITCH(TRUE(),
[Total] < _average,"red",
"black")
RETURN "<tr>" & "<td style= width:150px;><font size=" & _a & ">" & [Product] & "</font></td>" & "<td align=left><font size = 3>" & "Sales: </font>" &
"<font color=" & _b & ">"  &
[Total] & "</font></td>" & "</tr>"  

 

 

vzhouwenmsft_2-1716258148839.png

3.Use the following DAX expression to create a measure

 

Measure = 
VAR _a = CONCATENATEX('Table',[Column])
VAR _b = SUM('Sales_Table'[Amount])
RETURN "<table >" &
 "<tr>" & "<td><font size = 6>Product</font></td>" & "<td><font size = 6>Sum of Amount</font></td>" & "</tr>" &
 "<td colspan = 2><hr style = border-color:blue;></td>" &
 _a &
 "<td colspan = 2><hr style = border-color:blue;></td>" &
 "<tr>" & "<td><font size = 6>Total</font></td>" & "<td align=right><font size = 6>" & _b & " </font></td>" & "</tr>" &
 "</table>"

 

 

4.Final output

vzhouwenmsft_3-1716258157750.png

 

 

 

TomMartens
Super User
Super User

Hey @StephenF ,

 

unfortunately the answer is - No!
The font size of values of the table/matrix visual are not dynamic.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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