如何在 SSRS 饼图图例中显示百分比和值?

How can I display the percentage and value in a SSRS pie chart legend?

在 SSRS 饼图图例中,我可以通过右键单击图表 > 属性 > 图例属性 > 单击函数图标并输入以下表达式轻松显示字段的值:=(Fields!myField.Value)我还可以使用 #PERCENT 轻松显示每个字段的百分比,但是我无法找到连接两者的正确语法。我试过最明显的: =(Fields!myField.Value) & " " & Cstr(#PERCENT)

这会起作用

=(Fields!myField.Value) & " " & ((Fields!myField.Value)/SUM(Fields!myField.Value, "myDataSetName"))

这是一个例子...

我创建了一个简单的数据集和饼图。然后我右键单击任何饼图段然后 select series properties。接下来单击 Legend' tab and set theCustom Legend Expression`,类似于上面的内容。在我的例子中,我使用了以下...

=(Fields!Amount.Value) 
& " (" 
& Format(((Fields!Amount.Value)/SUM(Fields!Amount.Value, "DataSet1")), "p2")
& ")"

设计看起来像这样。

完成后的图表是这样的