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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Oded-Dror
Helper III
Helper III

Format String

Hi there,

I created a string from AdventureWorksDW - Product and sales looks like that (I will use it in a slicer under Product Categories

Label =
Var SalesAmount = Format(Sum(Sales[Sales Amount]), "Standard")
VAR QTY = FORMAT(sum(Sales[Order Quantity]),"Standard")
VAR Space = REPT(UNICHAR(127),40-Len('Product'[Product]))
Return
'Product'[Product] & " " & Space & SalesAmount & REPT(UNICHAR(127),20-Len(SalesAmount)) & QTY
 
But from some reason it not alighn well the sales and Quantity is not strait the expected result need it to be like this
Product Name           Sales            Quantity
Abc Prod                    123.33         75
Long Product Name   2000.00      300
 
How do I format this string like the expected result
Thanks,
Oded Dror
4 REPLIES 4
AlexisOlson
Super User
Super User

If you aren't using a fixed-width (monospaced) font, then you won't easily be able to get things to align using spaces since most fonts don't have the same width for spaces as every other character.

So is there any solution to that? If so any examples wil be much appriciated

Thanks,

Oded Dror

You could use a monospaced font or use multiple columns instead of a single concatenated label.

 

Expecting a variable-width font to act like a monospaced font will only lead to frustration.

But this is going to be in a slicer which don't have multiple column that way I'm building the string
And slicer don't have alignment 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.