Forum Discussion
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
- v-yueyunzh-msft
Community Support
Hi , a68tbird
Sorry , i am not very familiar to the Report Services and the calculated fields , for your error code , i searched on the internet and find some similar like yours, you can refer to and i hope it can help you :
reporting services - Totalling based on expression field - Stack OverflowHow to use aggregate function in expressions? (microsoft.com)
reporting services - Adding a simple calculated field in SSRS? - Stack Overflow
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly