MAX(DateField) returns last row in group, not the max

9 posts, 0 answers
  1. Rick
    Rick avatar
    8 posts
    Member since:
    Apr 2011

    Posted 09 Jan 2012 Link to this post

    Version:  5.3.11.1116

    On several reports, in group/report summary lines, I need to return the maximum date for the group.  What is returned instead by =Max(Fields.LastTranDate) is simply the LastTranDate value of the group. 

    Data type of LastTranDate in database/entity framework:  datetimeoffset: 

    How do I actually get the maximum date value rather than the value of the maximum row? 
  2. IvanY
    Admin
    IvanY avatar
    417 posts

    Posted 12 Jan 2012 Link to this post

    Hi Rick,

    We were unable to reproduce the problem on our end. What you can do is to send us a runnable sample project in order to help us exhibit the problem at our side. Additionally you can create your own user function - for more information you can check our Crosstab demo and our User Functions KB article.

    Regards,
    IvanY
    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. Balen
    Balen avatar
    5 posts
    Member since:
    Oct 2018

    Posted 22 Oct Link to this post

    HI Guys, 

    I have this issue too. I know this is feed is pretty old but i have not been able to find the solution anywhere. so wondered if any one had any luck.

  4. Neli
    Admin
    Neli avatar
    184 posts

    Posted 25 Oct Link to this post

    Hello Balen,

    If you want to display the MAX date for a specific group, one of the ways is by the Exec function which accepts two arguments:

    - the data scope - in this case, it will be the group

    - the expression - "= Max(Fields.Date)"

    So, eventually, the expression that will display the MAX date for each group will be:

    = Exec("group", Max(Fields.Date))

    Another option is if you have report groups. In this case, you can display the MAX date in the group footer section. Then you don't need to specify the scope, so the Expression will be:

    = Max(Fields.Date)

    This is demonstrated in the attached report.

     

    Regards,
    Neli
    Progress 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
  5. Balen
    Balen avatar
    5 posts
    Member since:
    Oct 2018

    Posted 29 Oct in reply to Neli Link to this post

    Hi Neil,

    Thank you for your recommendation.

    In my situation i want to make a report as follows.

    I am trying to create a report where agents have logged on to different campaigns through out the day. so i want to know the first time they logged in and the last time they logged out of any of the campaigns they have worked on through out the day. I have used the later of the recommendation however this seems to only get the last logged out of the campaign they first logged into.

    Version: 10.2.16.1025

  6. Neli
    Admin
    Neli avatar
    184 posts

    Posted 01 Nov Link to this post

    Hi Balen,

    It is strange that after applying the solution, the report does not work as expected. Which field do you use for the grouping? Make sure the Aggregate function is in the scope of the grouping section. I suggest to send us screenshots of the report, so we can try to reproduce the behavior.

    I am also attaching the previous report in version  10.2.16.1025.

     

    Regards,
    Neli
    Progress 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. Balen
    Balen avatar
    5 posts
    Member since:
    Oct 2018

    Posted 01 Nov in reply to Neli Link to this post

    Hi Neil,

    Attached is screenshots of the details.

    So the 2 columns that are in the database and the stats that are being pulled into telerik. 

    This 2 telerik snippets are from reports made in telerik. 

    The first is when i used functions FIRST and MAX but we can see that the MAX function is not getting the correct value.

    The second is using MIN and MAX functions, from this we can see that neither of the stats are correct.

    I am using oData V4 to get data from postgres to telerik.

  8. Nasko
    Admin
    Nasko avatar
    1070 posts

    Posted 06 Nov Link to this post

    Hello Balen,

    The only possible options for the MIN and MAX functions to not work as expected are:

    • The compared data fields are of a string data type and the functions return unexpected results;
    • The comparison is executed in a different data scope and cannot compare all of the data;
    • When working with DateTime types the comparison takes into account only the Date part of the value;

    It is not technically possible to understand which of the above are in effect in your scenario, unless you provide us a sample report with dummy data demonstrating the issue, or modify the report which was provided in previous replies, so it replicates the problem.

    Regards,
    Nasko
    Progress 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. Balen
    Balen avatar
    5 posts
    Member since:
    Oct 2018

    Posted 8 hours ago in reply to Nasko Link to this post

    Thank you, couldnt get it to work in the trdx so sorted in the data source.

    Thank you for your assistence

Back to Top