user2523188
user2523188

Reputation: 61

EXPRESSION - SQL Reporting Builder - Count & SUM to specific field

i try to sum a total into a different field if different condition. Please guide me to the correct way.

Product A       gender           total no. of male buy         total no. of female buy
   Buy           male                     1                              3
   Test          male
   Buy           female
   Buy           female
   Buy           female

any idea ? the result = total number male or female who "buy" the product A. lease guide me to the correct way. I'm using reporting builder 2008 r2, my knowledge on this builder limited.

Upvotes: 1

Views: 1324

Answers (1)

M.Ali
M.Ali

Reputation: 69524

Shouldn't these values be at the end of the report? You cannot show sum of all rows in front of one of the rows itself, Its very misleading. Add Two rows outside the group at the end of the report and then use the following expressions to show counts.

Expression For Male

=Sum( 
   IIF( Fields!ProductA.Value = "Buy" AND Fields!gender.Value = "male", 1, 0)
   )

Expression For Female

=Sum( 
   IIF( Fields!ProductA.Value = "Buy" AND Fields!gender.Value = "Female", 1, 0)
   )

Upvotes: 1

Related Questions