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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.