2016-11-10 255 views
0

當我計算就像在2008年百分比計算在SSRS

=SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0))/((SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0))+ SUM(IIF(Fields!REMARKS.Value = "BAD",1,0))))*100 

getting result like 34.9632565235 


but i am trying to get result like 34.97% 

SSRS如下請分享您的經驗。

感謝

回答

0

嘗試:

=FORMAT(
SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0))/ 
((SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0)) + 
SUM(IIF(Fields!REMARKS.Value = "BAD",1,0)))),"P2") 

或者您也可以使用自定義字符串格式:

=FORMAT(
    SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0))/
    ((SUM(IIF(Fields!REMARKS.Value = "GOOD",1,0)) + 
    SUM(IIF(Fields!REMARKS.Value = "BAD",1,0)))*100) 
,"0.00") & "%" 

讓我知道,如果這有助於。

+0

@RohiniMathur,嘗試複製和粘貼我張貼同樣的表情。 –

+0

@RohiniMathur,我添加了另一個解決方案並更新了使用「P2」字符串格式的第一個表達式。 –

+0

其工作......我錯過了1個括號..........抱歉............ :) –

0

您還可以在表達式中使用Round函數。使用此功能=ROUND(..., 1)您將在小數點後有一個數字。如果您想在小數點後面輸入兩個數字,則輸入2,依此類推。 (所以你需要2)。

同時檢查鏈接:Percentage SSRS

在使用的例子:

=Round(((SUM(Fields!FirstCallResolution.Value)/COUNT(Fields!CommunicationId.Value)) * 100),1)