Forum Discussion

a68tbird's avatar
a68tbird
Icon for Resolver II rankResolver II
3 years ago

Paginated Reports - Calculation with Lookup Field

Hello all -

  Scenario: 2 datasets. First is a table called "Royalties" of all products with ID and a royalty rate. Second is sales table. I have created a lookup field that brings in the relevant royalty rate from the first dataset, but I need to multiply this rate with the quantity in the Sales table.  My lookup field is:

 

=Lookup(Fields!ProductId.Value,Fields!ProductId.Value,Fields!Deal_Split.Value, "Royalties")

 

BTW - this is not a calculated field, but rather just the formula entered straight into the Expression.

 

I figured it would be as simple as multiplying this by Fields!Quantity.Value but this actually doesn't do anything. It doesn't produce an error, but it just seems to ignore the multiplication and only returns the royalty rate. If I try to create a Calculated Field, I get the "aggregation" error:

The expression used for the calculated field 'Total_Rate' includes an aggregate, RowNumber, RunningValue, Previous or lookup function. Aggregate, RowNumber, RunningValue, Previous and lookup functions cannot be used in calculated field expressions.

 

Any suggestions on how I can produce my intended results? 

 

Additionally, totalling this column - if I recall from previously working with SSRS reports, there was some code that needed to be added to the report? Anyone point me in the right direction for this as well?

 

Thanks very much!

1 Reply