Vishnu Suresh
Vishnu Suresh

Reputation: 187

Adding whitespace in a DAX expression for display in PBI Card

I'm using Power BI to create a report.I'm creating a card where I have to show product sales/target sales. The following measure is being displayed on the card.

Measure 2 = ROUND(sum('Sales by Category'[ProductSales]),0) & "  /  " & Round(sum('Sales by Category'[TargetSales]),0)

I need some gap at both sides of the slash i.e 25000 / 30000 . But Even if I give multiple number of spaces before and after the / in the DAX expression,the resultant card looks like this. 25000 / 30000

only one whitespace is being displayed on both sides of the /. Is there any way to add a whitespace, like a '\t' or something?

Upvotes: 5

Views: 24011

Answers (3)

Balachandar Gopal
Balachandar Gopal

Reputation: 91

Create new measure like

WhiteSpace = UNICHAR(127)

And use it any where you need this like

Currentday = FORMAT(NOW(),"mm/dd/yy" & REPT(WhiteSpace,4) & "(DDD)")

Result :
01/18/22    (WED)

Upvotes: 9

Nandu krishna
Nandu krishna

Reputation: 21

In the latest Power BI desktop tool, we can turn off the word-wrap feature. Then it will show all the whitespaces.

word-wrap feature

Output

Upvotes: 2

Foxan Ng
Foxan Ng

Reputation: 7151

Interesting findings. I believe it's some built-in logic behind the visualizations which causes such inconsistent behavior.

It happens with Card and Multi-row card but not Table and Matrix:

inconsistent behavior

With that said, to workaround with such behavior, you can use some other whitespace character, for example the whitespace in fullwidth form  :

Measure = 123 & "     /         " & 456

Results: (The left part is fullwidth whitespace)

results

Upvotes: 5

Related Questions