简体   繁体   English

如何格式化Power BI中的计算量度?

[英]How to format calculated measure in power BI?

I've created a new measure in Power BI with the below DAX formula, it throws me an error of saying "The following syntax error occurred during parsing: Invalid token, Line 18, Offset 61, %." 我使用下面的DAX公式在Power BI中创建了一个新的度量,它引发一个错误:“解析期间发生以下语法错误:无效令牌,第18行,偏移61,%。”

New_Measure = 
 if(VALUES(POC[report]) = "A",
     Format ( (CALCULATE( 
     [Value Measure],
         FILTER(
                 ALL(POC),
                 POC[report]="B"),                                                                                                                                                                                   
                 VALUES( POC[project_number]
                )
                ) /
     CALCULATE(
     [Value Measure],
         FILTER(
                 ALL(POC),
                 POC[report]="C"),                                                                                                                                                                                                                                                              
                 VALUES( POC[project_number]
                )
               )) 0.00%), Format([Value Measure], $#,##0;($#,##0)))

How to resolve this error? 如何解决这个错误? any help is greatly appreciated, 任何帮助是极大的赞赏,

You're missing a comma before 0.00% in the final line, and you need to enclose your format string in quotes:: 在最后一行中,您在0.00%之前缺少逗号,并且需要将格式字符串用引号引起来:

           )), "0.00%"), Format([Value Measure], "$#,##0;($#,##0)"))

I'd strongly recommend trying https://www.daxformatter.com - it will help you debug typos like this more easily. 我强烈建议尝试使用https ://www.daxformatter.com-这将帮助您更轻松地调试此类错字。

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

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