Search code examples
reporting-servicesssrs-2008

ssrs reporting report with addition RowNumber function


I want to make report table in ssrs like this

row  D/C          nominal saldo

1   Credit        10      10
2   Debet         1       9 (from 10-1)
3   Credit        6       15 (from 9+6)    

How to make function "saldo" field as above?

the logical flow
when row number = 1 then saldo = nominal (just for first row).  
when row number = 2 and  D/C = Debit then "saldo" row 1 - nominal  
when row number = 2 and  D/C = Credit then "saldo" row 1 + nominal  
when row number = 3 and  D/C = Debit then "saldo" row 2 - nominal  
when row number = 3 and  D/C = Credit then "saldo" row 2 + nominal

I'm trying to use function RowNumber (Nothing),

Iif(RowNumber(nothing)=1,Fields!nominal.Value),
Iif(RowNumber(nothing)=2 and Fields!dc.Value = "Debit",previousFields!saldo.Value - Fields!nominal.Value ), 

and so on..

Could you give me suggestion about that scribs?

Regardz Thanks


Solution

  • You can do this with a running total. Assuming your number are all positive then just check the debit/credit column and multiply the value by -1 when required.

    Something like this should work.

    =RunningValue(Fields!nomial.Value * (IIF(Fields!dc.Value="Debit",-1,1) ,Sum,”yourDataSetName”)
    

    If you really want the row number as well then you can just add a column with the expression set to =RowNumber(nothing)