简体   繁体   English

SSAS - 如何配置计算度量的格式编号?

[英]SSAS - How to configure format number for calculated measures?

I created a calculated measure in order to allow user to display the operating margin about sales.我创建了一个计算度量,以允许用户显示有关销售的营业利润率。

ROUND([Measures].[Total] - [Measures].[Total Cost],2)

It works well, however I get an error when I try to retrieve the data in Excel / PowerPivot.它运行良好,但是当我尝试在 Excel/PowerPivot 中检索数据时出现错误。 In fact, It displays values by using the ",."实际上,它使用“,”来显示值。 format to separate decimals and my format is " ,). So how to configure to change this behavior in SSAS because Excel cannot format the number due to a "unknown type" (it cannot parse the number).格式来分隔小数,我的格式是“,”。那么如何配置以在 SSAS 中更改此行为,因为 Excel 由于“未知类型”(它无法解析数字)而无法格式化数字。

This an example of decimal conversion from US to French format :这是从美国格式到法语格式的十进制转换示例:

1,000,000.00 (US) -> 1 000 000,00 (France) 
99.99 (US) -> 99,99 (France)

OK I could replace the "dot" by a "comma" directly in Excel but it's not a good practice and the objective is to simplify the PowerPivot usage.好的,我可以直接在 Excel 中用“逗号”替换“点”,但这不是一个好的做法,目的是简化 PowerPivot 的使用。

Thanks !谢谢 !

In your SSAS project you can use "Format string" field to specify the format:在您的 SSAS 项目中,您可以使用“格式字符串”字段来指定格式:计算属性

In the code it looks this way:在代码中它看起来是这样的:

CREATE MEMBER CURRENTCUBE.[Measures].[ASP]
 AS [Measures].[Amount]/[Measures].[Units], 
FORMAT_STRING = "$#,##0.00;($#,##0.00)";     

Use either manual string to create exact look or if all your environments are properly set up as French locale, there is a standard "Currency" format string which also might work in your favor.使用手动字符串来创建精确的外观,或者如果您的所有环境都正确设置为法语语言环境,则有一个标准的“货币”格式字符串也可能对您有利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM