Find The Max& Min in dd/MM/yyyy

  • i am using SSRS in a Report i have a colomn Cotaining Date in dd/MM/yyyy Format

    11/12/2008

    11/12/2008

    12/12/2008

    12/12/2008

    12/12/2008

    15/12/2008

    15/12/2008

    15/12/2008

    by this colomn i need to find Max and Min at Runtime/Report Preview.

    as i am using text to display heading or the report.

    Reporting from 11/12/2008(min) to 15/12/2008(max)

    so this heading will vary as per the new entries of new date and report viewing..

    Please provide the solution

  • deepak.spiral (11/18/2008)


    i am using SSRS in a Report i have a colomn Cotaining Date in dd/MM/yyyy Format

    11/12/2008

    11/12/2008

    12/12/2008

    12/12/2008

    12/12/2008

    15/12/2008

    15/12/2008

    15/12/2008

    by this colomn i need to find Max and Min at Runtime/Report Preview.

    as i am using text to display heading or the report.

    Reporting from 11/12/2008(min) to 15/12/2008(max)

    so this heading will vary as per the new entries of new date and report viewing..

    Please provide the solution

    select Max(DateColumn) from tablename

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • Hi,

    Please find the below example which will give the max and min date value.

    declare @max-2datetime

    declare @min-2datetime

    begin

    select @max-2=max(ord_date),@min=min(ord_date) from sales

    select * from sales where ord_date =@min

    end

  • thanks for your previous solution ,,but tht wont work at reporting level.

    Let me explain you

    if my date field in the Reports is "=Fields!Store_ID.Value" that will contain all the listed Date values when we view the reports in

    DATE-column.

    do we have any way to use any function/experession that i will use in "Edit Expression " for this field to get Max/Min of dd/MM/yyyy date.

    i dont want to make any change at Database level. only @ Reporting side..

    i hope problem is now very specific ..please help me out

    thanks

  • Didn't read in detail

    but for a SSRS report, if you try to use a field NOT inside its group

    you can only use AGGREGATE functions or FIRST/LAST etc...

    so you could have all the rows inside a Table object

    and you can create a textbox, and put the expression of =MAX(dateColumn) and it'll display the Max date from that Dataset

    (or just drag-and-drop the date column from Dataset into the Textbox, and change the aggregate function name)

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • thanks a lot buddy

    it worked Perfectly.

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

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