Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD & QTD Expression with an alternate start of year?

Hi All,

I'm trying to get the max value within a period (YTD & QTD) for a field, where I have a moving start of year defined by a user input so it will not be the 1st of Jan. I don't appear to be getting expected values with my command below

=max(if(InYearToDate(DateRecorded,today(1),0,0),Reading)) retrieves the right ytd values assuming a Jan start of year.


=max(if(InYearToDate(DateRecorded,today(1),0,7),Reading)) I've tried putting first month of year as 7 for July so that I should a different value in my table, but I'm getting the same value as the expression above.


1.png
 

Any ideas?

Thanks

Steve

5 Replies
Not applicable
Author

hi,

     Can you please attach any image or sample data which  will show correct answer which you want.

Thanks,

Ashutosh

jagan
Luminary Alumni
Luminary Alumni

Hi Steve,

If you want to get the max value in July 2013, then try this expression

=Max({<DateRecorded={'>=$(=MonthStart(MakeDate(2013, 7)))<=$(=MonthEnd(MakeDate(2013, 7)))'}>} Reading)

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi Steve

You need

=max({<DateRecorded={">=$(vYrStart)"}>} Reading)

This will return the maximum reading for all dates >= the variable vYrStart, where vYrStart is set as the date by your users (you could have them set it in a slider object if you want.

Give me a shout if it doesnt work

Erica

Not applicable
Author

Hi All,

Thanks for the help thus far, but none thus far answer my question really.

I want to be able to use YTD & QTD in the functions inXXXtodate so that I can easily pick out previous and future time periods. My understanding of the function is from the Ref Manual.

InQuarterToDate (date, basedate , shift [, first_month_of_year =1])

So I am not sure why I can get a year to date or quarter to date figure with a start of year for July. I want my YTD 7 to show 3200 from the above table assuming my start of year was in July?

Does that make sense?

Thanks

Steve

Not applicable
Author

Hi All,

I've added a better definition of what I am after which may help with the understanding.

Thanks

Steve

Screenshot 2013-11-24 20.18.36.png