Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a data table with 2 years of data by week, by writing agent. I have a straight table that shows 13 columns for the current 13 weeks (based on date selected by user) and a column computing the 13WkAvg and column computing a 4WkAvg.
I have a project where we are changing our weekly cutoff from Friday to Monday. Therefore my charts won't function as I current have them. There is a calendar listbox where the user selects the rundate they want to start from. The current chart then calculates the header date to displayed by by subtracting 7 from the selected date for the previous week, then subtracting 14 from the selected date for the 2nd week prior and so on...
Now that my history will have Friday dates and Monday dates, subtracting 7 no longer works. Is there a function I can use in the column HEADER/label to identify the MIN(reportweek) used in the column's expression?
Currently my column expressions look like this:
For Current Week: sum({$<msd.RunDate=,msd.numReportWeek={'$(=num(msd.RunDate)-0)'}>} msd.NetAnnlzdPrem)
For 1st Prior Week: sum({$<msd.RunDate=,msd.numReportWeek={">=$(=num(msd.RunDate)-10)<=$(=num(msd.RunDate)-7)"}>} msd.NetAnnlzdPrem)
For 2nd week prior: sum({$<msd.RunDate=,msd.numReportWeek={">=$(=num(msd.RunDate)-17)<=$(=num(msd.RunDate)-14)"}>} msd.NetAnnlzdPrem)
and so on until I get to -87 and -84 for week 13.
msd.Rundate is the Calendar listbox the user selects for the starting week they want to display from going back 13 weeks.
For each column header I need to use the msRunDate used in the data being summed.
I was able to resolve this by setting a variable with the date of our First monday cycle date, and then adding the following to each of the 13 columns adjusting the number days from/to to compare to for each appropriate column:
=if (msd.numReportWeek < $(vnumStartupDate),
Date(num(msd.RunDate)-7,'MM/DD/YY'),
if (msd.numReportWeek - 10 < $(vnumStartupDate),
Date(num(msd.RunDate)-10,'MM/DD/YY'), Date(num(msd.RunDate)-7,'MM/DD/YY')))
I was able to resolve this by setting a variable with the date of our First monday cycle date, and then adding the following to each of the 13 columns adjusting the number days from/to to compare to for each appropriate column:
=if (msd.numReportWeek < $(vnumStartupDate),
Date(num(msd.RunDate)-7,'MM/DD/YY'),
if (msd.numReportWeek - 10 < $(vnumStartupDate),
Date(num(msd.RunDate)-10,'MM/DD/YY'), Date(num(msd.RunDate)-7,'MM/DD/YY')))