开发者

MDX format_string for % doesn't multiply by 100 when % sign is at the front

开发者 https://www.devze.com 2022-12-20 07:03 出处:网络
For the following query: with member testVal as 0.1234 member testNormal as testVal member testPrepend as testVal, format_string=\"%##.00\"

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/wei开发者_如何转开发rd? I feel the testPrepend member should also be multiplied by 100, but it's not.


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]
0

精彩评论

暂无评论...
验证码 换一张
取 消