Calculating in SSRS vs Calculating in SQL

  • There are a couple of calculated fields that I'm using in the report I'm currently writing. I've been doing all the calculation in the query so far, so by the time it reaches SSRS, everything is already calculated, and reporting services do not have to do any additional work. I was wondering whether, it would be better any faster to do calculations in SSRS? So far I've done some testing on my own, and it seems that it is marginally quicker to use calculated fields in SSRS over doing the calculations in code.

  • It's my opinion that doing calculations, when practical, in SQL is a better path. I have done plenty of calculations in SSRS though when it would be much harder or costly to do them in SQL. All my reports use stored procedures for their datasets which brings the added advantage of being able to change the calculation without having to redeploy the report.

  • I'm with the above poster, i prefer to do all my calculations through SQL which i find faster than through SSRS

  • I'll add a 3rd voice in favor of resolving all calculations in a stored proc, inline table valued function, or view. Heh... so much so that if I don't need something like a Pie Chart, I just blast through the necessary HTML as well with the help of FOR XML PATH... and it's very, very fast.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • As long as it's an "actual" calculation, I'd agree with all previous opinions. If calculation comes to mean something having to do with actually formatting the output, then put those in the SSRS part.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • It's one field being multiplied by the other one to get totals. I do that in SQL, and then sum it in SSRS

  • That is the practical approach that I would take.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply