views:

285

answers:

1

For the following query:

with 
member testVal as 0.1234
member testNormal as testVal
member testPrepend as testVal, format_string="%##.00"
member testMidpend as testVal, format_string="##%.00"
member testAppend as testVal, format_string="##.00%"
select { testNormal, testPrepend, testMidpend, testAppend} on axis (0)
from [SomeRandomPlace]

The following is returned:

testNormal  testPrepend     testMidpend     testAppend
0.1234      %.12            12%.34          12.34%

This is causing issues, as we use the same format string in .NET as a post-process operation (some control requires us to do this), and it behaves as expected (multiplying it by 100 because of the % sign).

Is this documented behaviour? Or some obscure bug? Or am I doing something wrong/weird? I feel the testPrepend member should also be multiplied by 100, but it's not.

+1  A: 

Documented behaviour seems to imply your method should work: http://msdn.microsoft.com/en-us/library/ms146084.aspx

Represents a percentage placeholder. The expression is multiplied by 100. The percent character (%) is inserted in the position where the percentage appears in the format string.

I've tried it with larger numbers, to ensure the mask is filled, it just seems to ignore the percentage symbol if it is the first character? Maybe raise it with MS Connect?

with 
member testVal as 13.1234
member testNormal as testVal
member testFront as testVal, format_string = "%##.00"
member testFrontBack as testVal, format_string = "%##.00%"
member testString as testVal, format_string="Percent"
member testSymbol as testVal, format_string="%"
member testStringSymbol as testVal, format_string="%Percent" //Lol
select { testNormal, testFront, testFrontBack, testString, testSymbol, testStringSymbol} on axis (0)
from [Cube]
Meff