Link to home
Create AccountLog in
Avatar of Erin Leale
Erin LealeFlag for United States of America

asked on

SSRS Declare a Variable

Good day!  

I'm new to SSRS reporting, Crystal Reports veteran.   We are using SSRS Report Builder 3.0 with Epicor 10.  I need to declare a variable on my report.  Here are the details:

Labor Burden Rate Budget to Actual Report
Data set is my Epicor BAQ and contains all the data I need
I need to name this value and use it in a formula across departments
 =abs(sum(Fields!Calculated_Sales.Value))  
When I add a Variable to the Report Properties - I get an Error attempting to run the report:

I have tried various versions of the formula and tried to declare or name the variable and I'm missing something obviously....  

User generated image
I get this error:

      The Variable(vSalesYTD) expression for the report ‘body’ uses an aggregate expression          without a scope.  A scope is required for all aggregates used outside of a data region             unless the report contains exactly one dataset.

In Crystal Reports - The naming of the variable was straight forward.  In here - I'm lost.  I've exhausted my search for help on the web and SSRS help that I have available.  

Any help would be greatly appreciated.  

Thank you so much!
EL

Avatar of Bembi
Bembi
Flag of Germany image

You may try
=abs(sum(Fields!Calcualted_Sales.Value, [Name of Dataset]))
where [Name of Dataset]  is the name (see Dataset), where the field is comming from. 
SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Erin Leale

ASKER

I received another error - here is my Dataset Properties:





User generated image
I made this change:
User generated image
I get this error:
User generated image
Any ideas?
Thanks! 
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Right that was my bad...should be
 =abs(sum(Fields!Calculated_Sales.Value,"BAQReportResult" ))