2013-03-12 115 views
1

我建立在Visual Studio中的報告,並有各種計算的東西像總等如何總結2個聚合函數

我現在想找到兩個總數的百分比,但我在努力爲它贏得」允許我在一個表達式中使用2個聚合函數。

的功能我已經是:

=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services") 

=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services") 

他們是相同的功能,但2個不同的總計行爲所以爲了找出個我必須分配這兩個相互作用見下文: -

=Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")/=Sum(Fields! Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services") 

任何人都可以提出一個更好的方法來做這個?

非常感謝,

+0

在不同的數據集上使用[LookUp](http://msdn.microsoft.com/en-us/library/ee210531.aspx)函數。 – 2013-03-12 10:47:06

+0

感謝您的回覆Preet。我不完全確定如何對這些值執行查找功能,您可以進一步解釋嗎? – user1086159 2013-03-12 11:29:27

回答

0

可以使用Val函數

只要試試這個

=Val(Sum(Fields!Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services"))/Val(Sum(Fields! Quantity.Value, "AccruedHours") + Sum(Fields!Quantity.Value, "Services")) 
+0

感謝ling.s幾乎把我帶到了我需要的地方,但是當我使用你的腳本時,我的回答是1,因爲它們在這方面包含相同的總值,但是卻得到了總數的值?例如兩個總數都是1391,並且相互分開,我期望值爲1,但是我得到了1391?任何進一步的建議 – user1086159 2013-03-12 11:42:55

+0

告訴我這兩個值 – 2013-03-12 11:47:03

+0

沒問題Quantity.Value,「AccruedHours」= 535的值和Quantity.Value的值,「Services」= 856與我的原始總計總計帶來總共1391. – user1086159 2013-03-12 11:51:30

0

我設法弄清楚到底。

我這樣做的方式是使用下面的代碼引用確切的文本框,而不是嘗試執行單獨的聚合函數。這樣我就必須在這兩個總數上做一個分水嶺。

請參見下面的代碼: -

=(ReportItems!textbox20.Value)/
(ReportItems!textbox22.Value) 

不管怎樣,謝謝您的建議,原來的問題。