How to find the Maxdate in Dundas ?

I have a stored procedure with a date time field which returns 1/1/2017 12:00:00 AM. However there is a requirement to show the Last date of the month and also return it in MMM format… So now the output is 31-JAN-2017. I used the below code to do this. But I had to change the format of the calculated element from DateTime to String as I’m using the ToString function. However in another visual I should find the Maximum date. However I’m unable to do this as I already converted the type to string. Any help ?

DateTime date = $ReadingDate$;
var firstDayOfMonth = new DateTime(date.Year, date.Month, 1);
var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
return lastDayOfMonth.ToString(“dd-MMM-yyyy”);

1 Like

You should not convert dates to string. Keep the fields as Dates and then use time dimension formatting options.