Report Service calculation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • voroojak
    New Member
    • Feb 2007
    • 92

    Report Service calculation

    Hi
    i am working with report service in sql server 2005.
    I have a problem with calculation.
    what i want to do is something like this

    =IIf Fields!total_sp b_week_this_yea r.Value= 0 then 0
    else
    100 * (Fields!total_x ch_comp_week_th is_year.Value +
    Fields!total_xc h_1_4_1_week_th is_year.Value) /
    Fields!total_sp b_week_this_yea r.Value

    but i dont know what shall i add and wher shall i put.
    i put this command in expression in the filed but it didnt work.

    thanks alot for any help.
    voroojak
  • voroojak
    New Member
    • Feb 2007
    • 92

    #2
    i just tried this and it seems that it is working, but i dont know how can i round it.
    =IIF (Fields!total_s pb_week_this_ye ar.Value>0 ,
    (Fields!total_x ch_comp_week_th is_year.Value +
    Fields!total_xc h_1_4_1_week_th is_year.Value) * 100 /
    Fields!total_sp b_week_this_yea r.Value,0)

    but thre result is 72.256471568124
    but i want to get 72
    or if it is 72.68545121654 i want to get 73

    how is it possible.
    i put ROUND at the begining but it didnt work.

    thanks

    Comment

    • leela mn
      New Member
      • May 2007
      • 43

      #3
      You can use Formatting
      Format (value,"N").... ..

      Comment

      • voroojak
        New Member
        • Feb 2007
        • 92

        #4
        thanks,
        i tried to use round and it worked some how, can u please explain this function to me, because i also need to have with one digit decimal. i used round (X,1) but in some rows that it is for example 2.4000001, it dowsnt give me me 2,4 or if it is 2.5.99999 it is not giving me 2.6.
        thanks alot for ur help.

        Comment

        • leela mn
          New Member
          • May 2007
          • 43

          #5
          This is the formatting options provided in the reporting service.
          Format (value,"N") -- two decimal points
          Format(value,"N 1") -- one decimal point
          etc..,

          Comment

          Working...