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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.