Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

CAlculate debits and credit total in ssrs report Expand / Collapse
Author
Message
Posted Saturday, September 4, 2010 4:51 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 23, 2011 12:38 AM
Points: 110, Visits: 304
Hi All.... Im struck up at this point since yesterday..Please help.

I have a an ageing report which shows all the amounts of the customer.
I have all the debitted and creditted amount of the customer in a single column that i get from a dataset. Based on the ageing i display the amount accordingly like records < 30 days, > 30 days and so. I have to find out the total of the column adn also the total of debitted amount and creditted amount separately.
Let me show how my report looks like :

CustomerGroup CustomerId Items< 30 Amount< 30 Items >30 Amount>30 TotalItems TotalAmount
AG 1 1 100 2 100 3 200
SI 11 0 0 1 -250 1 -250
LG 5 2 150 1 100 3 250
------------------------------------------------------------------------------------------------------
Total 3 250 4 -50 7 200
CR 0 -250 -250
DR 250 200 450



Iam able to find the grand totals of all the columns but finding it tough to find the total of cr and dr amounts.


With Regards,
Anu..
Post #980615
Posted Saturday, September 4, 2010 7:36 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:04 AM
Points: 7,019, Visits: 12,913
would something like the following help?
SUM(CASE WHEN col1> 0 THEN col1 ELSE 0 END) AS DEBIT,
SUM(CASE WHEN col1< 0 THEN col1 ELSE 0 END) AS CREDIT

If not, please post table def and sample data of the underlying table in a ready to use format as described in the first link in my signature together with your expected result.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #980625
Posted Sunday, September 5, 2010 8:42 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 23, 2011 12:38 AM
Points: 110, Visits: 304
Thanks Lutz for your reply...

I cannot use it in the sql part. The requiremment is such that i should get the raw data from the tables and perform all others transformations from the ssrs side. Also I need to display these credit and debit totals in the report footer.
I tried something like :

Iif (ReportItems!textbox1.Value < 0,Sum(ReportITems!textbox1.Value,0) in txtCRTotal textbox.

Iif(ReportItems!,textbox1.Value =0 OR ReportItems!.textbox1.Value>0, Sum(ReportITems!textbox1.Value),0)

But it is giving the error that multiple report items cannot be used.
If i pass a numeric values to the iif statement like,
IIF(ReportItems!textbox1.Value <0 , 1, 0) it works fine.

Is it something like we cannot pass reportitems in the iif statement ?

Any clue...?


With Regards,
Anu..
Post #980885
Posted Monday, September 6, 2010 2:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:04 AM
Points: 7,019, Visits: 12,913
anuhya.mudumba (9/5/2010)
Thanks Lutz for your reply...

I cannot use it in the sql part. The requiremment is such that i should get the raw data from the tables and perform all others transformations from the ssrs side. Also I need to display these credit and debit totals in the report footer.
...

It's kind of a philosophical question whether you consider using a query in SSRS as a data source (e.g. to preaggregate the data) instead of plain tables being part of SSRS process or not...
I would question such a requirement.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #980946
Posted Monday, September 6, 2010 5:21 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 23, 2011 12:38 AM
Points: 110, Visits: 304
Hey Lutz......
U r right....i have the same doubts though but i instructed to bring the max benifits of using ssrs and it is one among them.
i have to do all the calculations , aggregations , grouping , sorting, everything only in ssrs and not strictly in sql
And this one is eating out my mind.....
Any help ???


With Regards,
Anu..
Post #981039
Posted Monday, September 6, 2010 6:10 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:04 AM
Points: 7,019, Visits: 12,913
anuhya.mudumba (9/6/2010)
Hey Lutz......
U r right....i have the same doubts though but i instructed to bring the max benifits of using ssrs and it is one among them.
i have to do all the calculations , aggregations , grouping , sorting, everything only in ssrs and not strictly in sql
And this one is eating out my mind.....
Any help ???


All I can do is to repeat what I stated before: building a query as a data source in SSRS will fulfill the requirement to use SSRS only. T-SQL is part of SSRS, too.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #981071
Posted Monday, September 6, 2010 8:50 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, February 4, 2011 7:20 AM
Points: 977, Visits: 1,499
anuhya.mudumba (9/5/2010)
Thanks Lutz for your reply...

I cannot use it in the sql part. The requiremment is such that i should get the raw data from the tables and perform all others transformations from the ssrs side. Also I need to display these credit and debit totals in the report footer.
I tried something like :

Iif (ReportItems!textbox1.Value < 0,Sum(ReportITems!textbox1.Value,0) in txtCRTotal textbox.

Iif(ReportItems!,textbox1.Value =0 OR ReportItems!.textbox1.Value>0, Sum(ReportITems!textbox1.Value),0)

But it is giving the error that multiple report items cannot be used.
If i pass a numeric values to the iif statement like,
IIF(ReportItems!textbox1.Value <0 , 1, 0) it works fine.

Is it something like we cannot pass reportitems in the iif statement ?

Any clue...?


I think you want to sum the result of the conditional like this...
Sum(Iif (ReportItems!textbox1.Value < 0,ReportITems!textbox1.Value,0)) in txtCRTotal textbox.
Sum(Iif (ReportItems!textbox1.Value > 0,ReportITems!textbox1.Value,0)) in txtDBTotal textbox.
I hope I got it right, but I couldn't test it. I hope you get the idea though.


Tom Garth
Vertical Solutions

"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
Post #981144
Posted Tuesday, September 7, 2010 12:01 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 23, 2011 12:38 AM
Points: 110, Visits: 304
Thanks Tom...
I already tried the expression u mentioned but i got the error as :

The Value expression for the textbox txtCRTotal refers to more than one report item. An expression in a page header or footer can refer to only one report item.
The expression I tried is :
SUM(IIF ( ReportItems!txtNoOfItems30.Value < 0 ,ReportItems!txtNoOfITems30.value , 0))

I used the above expression in the page footer.

The report executes well if I pass numerics as iif result sets.


With Regards,
Anu..
Post #981335
Posted Tuesday, September 7, 2010 7:12 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, February 4, 2011 7:20 AM
Points: 977, Visits: 1,499
Doesn't summing the same conditional for the detail row values get you what you want?

Tom Garth
Vertical Solutions

"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
Post #981546
Posted Tuesday, September 7, 2010 7:39 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 8:41 AM
Points: 2,818, Visits: 2,553
If I understand correctly:
You want to totals of the debits and of the credits.
The debits and credits do not show individually in the detail because you have put them in a single column.
You, for some reason, are restricted from doing this in the SQL of the data set

I think you might find it easier to make 2 hidden columns in your detail. One for credits and one for debits. Once you have the debits and credits in separate columns, you should find it much easier to get totals for each.
Post #981572
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse