Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

คำตอบ DATEDIFF calculation

  • 30 เมษายน 2555 11:34
     
     

    Hi,

    how can i calculated avg in report services SSRS with two parameters (@fromdate , @todate)

    plz i need your help

    thanks;

ตอบทั้งหมด

  • 30 เมษายน 2555 11:37
    ผู้ดูแล
     
     

    Hi there

    can you please explain further what kind of avg you are trying to achieve.

    many thanks

    syed

  • 30 เมษายน 2555 12:18
     
     

     i want to  calculate   SUM( QTE) / (@todate  -  @fromdate)

    exemple:

    todate 2009/05/02  and   fromdate 2009/04/03

    and QTE is a measure

    thk

  • 30 เมษายน 2555 12:38
    ผู้ดูแล
     
     คำตอบ มีโค้ด

    hi there

    please use this expression in your report

    many thanks

    syed

    =Sum(Fields!RejectQty.Value)/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)

  • 1 พฤษภาคม 2555 9:37
     
     
    Hi Syed ,



    thank you for your reply but i want a avg for each row of measure . In other terme , i want
    for exemple : Reject Qty

    10/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)
    16/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)
    8/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)
    8/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)
    90/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)
    190/DateDiff("d",Parameters!date2.Value,Parameters!date.Value)

    these measures will be saved in other colomn


    in my case i will have QTE COM
     
    [URL=http://imageshack.us/photo/my-images/171/capturezf.png/][IMG]http://img171.imageshack.us/img171/3421/capturezf.png[/IMG][/URL]

    Uploaded with [URL=http://imageshack.us]ImageShack.us[/URL]
    • ทำเครื่องหมายเป็นคำตอบโดย mabrouko 1 พฤษภาคม 2555 13:54
    • ยกเลิกการทำเครื่องหมายเป็นคำตอบโดย mabrouko 1 พฤษภาคม 2555 13:55
    •  
  • 1 พฤษภาคม 2555 10:06
    ผู้ดูแล
     
     คำตอบ มีโค้ด

    Hi There

    Create a new column next to your measure and please put the formula in the column.

    I have attached a screenshot for that

    Many thanks

    Syed Qazafi Anjum

    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

    =Sum(Fields!RejectQty.Value) / DateDiff("d", Parameters!date2.Value, Parameters!date.Value)

    • เสนอเป็นคำตอบโดย Syed Qazafi AnjumMicrosoft Community Contributor, Moderator 1 พฤษภาคม 2555 10:06
    • ทำเครื่องหมายเป็นคำตอบโดย mabrouko 1 พฤษภาคม 2555 10:29
    • ยกเลิกการทำเครื่องหมายเป็นคำตอบโดย mabrouko 1 พฤษภาคม 2555 13:54
    • ทำเครื่องหมายเป็นคำตอบโดย mabrouko 1 พฤษภาคม 2555 21:28
    •  
  • 1 พฤษภาคม 2555 11:38
     
     

    Hi  Syed,

    whene i try to execute , i have this response :<< Les restrictions imposées par l'indicateur CONSTRAINED dans la fonction STRTOMEMBER n'ont pas été respectées.>>

    thanks

  • 1 พฤษภาคม 2555 11:58
     
     

     hi Syed,     how did you configured the parameters date2 and date ?

     thanks

  • 1 พฤษภาคม 2555 13:54
     
     

    HI Seyd,

    how can i recover only date from << Parameters!FromDMDATEDATEJR.value >> in SSRS becauce i can not applicate datediff on it

    In My case i have : 

    Parameters!FromDMDATEDATEJR.value =[DM_DATE].[DATE-DAY].&[2005-03-03]

      please help

             thanks
  • 1 พฤษภาคม 2555 22:01
    ผู้ดูแล
     
     คำตอบ มีโค้ด

    Hi There

    Please use this expression. I hope this will resolve your problem

    =formatdatetime(cdate("2005-03-03"),dateformat.ShortDate)
    so you can put something like this
    =formatdatetime(cdate(Parameters!FromDMDATEDATEJR.value ),dateformat.ShortDate)

    • เสนอเป็นคำตอบโดย Syed Qazafi AnjumMicrosoft Community Contributor, Moderator 1 พฤษภาคม 2555 22:01
    • ยกเลิกการนำเสนอเป็นคำตอบโดย mabrouko 3 พฤษภาคม 2555 11:03
    • ทำเครื่องหมายเป็นคำตอบโดย mabrouko 3 พฤษภาคม 2555 11:04
    •