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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MarkusEng1998
Resolver II
Resolver II

Power BI Web removes intended, extra spaces in Measure

I created a measure that simulates two columns with a percentage and (count). It works fine in the Desktop. But the web version removes the spaces. The obvious solution is to simply use two columns, but the request is to combine both values into one column...

 

Is there another UNICHAR I should use that won't get trimmed?

Please advise. Thank you!

 

 

 

_rm% = 

VAR vRmPercent = CONVERT(ROUND(AVERAGE('200AttrRmCount'[rmPercent]), 2)*100, STRING)
VAR vLen	= LEN(vRmPercent)
VAR vLenRm  = LEN(CONVERT('200AttrRmCount'[_rmCount], STRING))
VAR vSpace  = 8
RETURN

IF (vLen = 0, "n/a", 
	IF (vLen = 1, "0" & vRmPercent & "%", vRmPercent & "%" )
		& REPT(UNICHAR(127), vSpace-vLenRm) & "(" & [_rmCount] & ")")

 

 

PowerBI 2023-10-17_10-40-44.jpg

8 REPLIES 8
MarkusEng1998
Resolver II
Resolver II

Sorry, it did not work.

 

 

Can you share 2-3 in your pbix , i will check it on my machine ?

combined measure 2 & 3

_rem%Total = VAR vRmPercent = CONVERT(ROUND(AVERAGE('200AttrRmCount'[rmPercent]), 2)*100, STRING)
VAR vLenRm  = LEN(CONVERT('200AttrRmCount'[_rmCount], STRING))
VAR vSpace  = 8
RETURN

[_rm%2] &
 REPT(UNICHAR(127), vSpace-vLenRm) &
[_rm%3]

 

MarkusEng1998_0-1697654953989.png

 

measure 3

_rm%3 = 

VAR vRmPercent = CONVERT(ROUND(AVERAGE('200AttrRmCount'[rmPercent]), 2)*100, STRING)
VAR vLen	= LEN(vRmPercent)
VAR vLenRm  = LEN(CONVERT('200AttrRmCount'[_rmCount], STRING))
VAR vSpace  = 8
RETURN

"(" &
IF (vLenRm > 3, 
		LEFT([_rmCount], vLenRm-3) & "," & RIGHT([_rmCount], 3),
		[_rmCount])
		& ")"

measure 2

_rm%2 = 

VAR vRmPercent = CONVERT(ROUND(AVERAGE('200AttrRmCount'[rmPercent]), 2)*100, STRING)
VAR vLen	= LEN(vRmPercent)
VAR vLenRm  = LEN(CONVERT('200AttrRmCount'[_rmCount], STRING))
VAR vSpace  = 8
RETURN

IF (vLen = 0, "n/a", 
	IF (vLen = 1, "0" & vRmPercent & "%", vRmPercent & "%" ))
MarkusEng1998
Resolver II
Resolver II

Thank you @Ritaf1983 , I will give this a try!

@MarkusEng1998 
Good luck, 99.99% it will work 🙂

Ritaf1983
Super User
Super User

Hi @MarkusEng1998 
Try to calculate 2 measures separately and just concatenate them in the basic way with space :
Final_measure = [measure1]&" "&[measure2]

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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