Praveen
Praveen

Reputation: 1

SSRS group by with sum in expression

I need to generate a calculated field with sum(Value1) and groupby(Value2) and use this this calculated field in the IIF condition to create other column.

I am trying to convert a SAP crystal report formula to SSRS

If Sum ({abc}, {123}) >0 then
{abc}/Sum ({abc}, {123}) *100
else 0

I need to do in SSRS.

Upvotes: 0

Views: 7104

Answers (2)

zoe zhi
zoe zhi

Reputation: 164

I am not sure what output you want to get? If possible, could you please inform me more detailed information(such as your data sample and your expecting output)?

And if you want to get sum of a specific group, you could use expression like below =sum(iif(Fields!group.Value="aa", Fields!abc.Value,0))

Zoe Zhi

Upvotes: 0

JamieD77
JamieD77

Reputation: 13949

the IIF syntax in SSRS is

=IIF(SUM(Fields!abc.Value, "Group123") > 0, 
   Fields!abc.Value/SUM(Fields!abc.Value,"Group123") * 100, 
   0
)

The "Group123" value is the name of the group you want to use.

Upvotes: 2

Related Questions