Month and Year function

8 posts, 0 answers
  1. Narender
    Narender avatar
    32 posts
    Member since:
    Feb 2016

    Posted 14 Mar Link to this post

    Hi All,

    I have a date field in my sql query.

    I want to create a report in which i want to show Current year(2016) and previous year(2015) data only.In the same way i want to show current month and previous month data.

     

    So can someone tell me how i can convert my date to current year and the previous year or current nonth and previous year.

     

    I am using Standalone report designer.

     

    Thanks,

     

    Narender

  2. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 16 Mar Link to this post

    Hello Narender,

    The built-in Date and Time Functions can be used to retrieve the current date. Using the DateTime Properties you can find the previous month/year inside an expression:

    Current year:       = Now().Year
    Previous year:     = Now().Year - 1
    Current month:    = Now().Month
    Previous month:  = Now().Month - 1


    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Narender
    Narender avatar
    32 posts
    Member since:
    Feb 2016

    Posted 17 Mar in reply to Nasko Link to this post

    Thanks Nasko,

    I will try and get back to you.

     

    Narender

  5. Narender
    Narender avatar
    32 posts
    Member since:
    Feb 2016

    Posted 21 Mar in reply to Nasko Link to this post

    Hi Nasko.

    Its really helpful.

    I am able to use Now() function .

     

    But i am facing a problem.

    when ever i used Now().year function in cloumn heading , it gives me year like 2016 but in data in that coumn is showing 2014,2015,2016 as i am using (fields.order_year).

     

    So i want to know how i can control  to take only 2016 year as i am using now().year in column heading,

    I have a column of order date  and i have created year through this  order date.Now i want to show sum(amount) against current year of order date .means  2016 and employe id.

     

    like :

     

    employe id    now().year   amount

    1                      2016               50

    2                       2016              60

     

    now().year is the column of order date of 2016.

     

    Only those data whose order is year 2016.

     

    Please tell me expression or any suggestion.

     

    Thanks,

     

    Narender

  6. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 21 Mar Link to this post

    Hello Narender,

    You can use Filtering to show data only for the current year.

    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Narender
    Narender avatar
    32 posts
    Member since:
    Feb 2016

    Posted 22 Mar in reply to Nasko Link to this post

    Hello Nasko,

    As you suggested , I have applied filter on table and sucessfully got 2016 year result.

    But this fiter option is available in property of table when i select whole table . How i can apply filter on item of table .

    To take result like this:-

     

    employe id    now().year                   now().year-1
    1                      sum(amount)              sum(amount) 
    2                       sum(amount)            sum(amount) 

     

     

    Thanks,

     

    Narender

  8. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 23 Mar Link to this post

    Hello Narender,

    The described structure can be achieved by creating column groups for the table. You can use the Group Explorer window to add column groups to your table, or you can use the Crosstab item.

    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Narender
    Narender avatar
    32 posts
    Member since:
    Feb 2016

    Posted 29 Mar in reply to Nasko Link to this post

    Hello Nasko,

     I have used the column group on 2015 and 2016 year with filter but it is showing all rows which i dont want to include means 2014 year rows also included in table as showing in figure.

    Note: 2014 year rows showing blank as i used filter in both 2015 and 2016 year column.

    So i want to exculde 2014 year rows . How i can achieve this??

     

    can you tell me how i can use "in " operation for 2015 and 2016 year filter.

     

    like 

    fields.year in (2015,2016)

    It is showing error when i apply this filter in row group.Please tell me to use IN operator too.

     

     

    Thanks,

     

    Narender

Back to Top
DevCraft banner