Calculating total of an expression column


i trying calculate total price invoice.

i have following columns in tabix:

purchaseordernumber, itemno, quantitiy, itemdescription, discount, unitprice, subtotal

the subtotal column (textbox8 in tabix) takes consideration unit price, quantity , discount , calculate by:

=(((((sum(fields!itemunitprice.value))/100) * (sum(fields!discount.value))) - (sum(fields!itemunitprice.value))) * (-1)) * (sum(fields!quantity.value))

i need calculate total of column. have tried =sum(reportitems!textbox8.value)

this brings error:

the value expression textrun 'textbox54.paragraphs[0].textruns[0]' uses aggregate function on a report item. aggregate functions can used on report items contained in page headers and footers.  

is there anyway of calculating need without value been in footer? if not, '=sum(reportitems!textbox8.value)' work in footer? doesn't seem obvious how add one.

if makes diffrence i'm using visual studio 2010, , creating windows form application.

thanks in advance

hello,

using report items in aggregate function , nested aggregate function not allowed in reporting services. solve
issue, 1 workaround using custom code.
please refer following sample code:

  dim public nettotal double     public function getvalue (byval subtotal double) double                 nettotal = nettotal+ subtotal                 return subtotal     end function      public function totalvalue()                 return nettotal end function

in report design surface,use getvalue function in textbox8 following expression:=code.getvalue(value expression in textbox)
in textbox right hand-side of 'net total', use following expression: =code.totalvalue().
more information, please see:
using custom code references in expressions (reporting services)

regards,
fanny liu


fanny liu
technet community support



SQL Server  >  SQL Server Reporting Services, Power View



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........