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?
8 Answers, 1 is accepted
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!
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.
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
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
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
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.
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
Thank you, couldnt get it to work in the trdx so sorted in the data source.
Thank you for your assistence