Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, All,
I'm stuck in solving an issue in my analytics.
There are three tables with the same Date field ([Actual ship date]). To have a correct separate calendar table with unique dates from all three tables I'm concatenating distinct date field from all tables in to one, and then got distinct values from that table. In new table such fields as Year, Quarter, Month, Week are created. Common thing in many analytics.
There is a need to have current Quarter Weeks selected on document open (e.g. now, first four weeks will be selected). I have special variable for maximal sales date (format DD.MM.YYYY). I can't use formula Max([Actual ship date]) in objects, 'cause there are budget data with dates in the future. I wrote the simple macro and associated it with document open action:
'------------------------------------------
' On Document Open
sub DocumentOpen
' 1. Selects Current Quarter
ActiveDocument.ClearAll True
set d=ActiveDocument.Fields("Actual ship date")
d.Select ActiveDocument.Evaluate("'$(MaxSalesDate)'")
ActiveDocument.Fields("Quarter").SelectPossible
ActiveDocument.Fields("Year").SelectPossible
' 2. Selects Actual weeks for correct Budget
d.Select "<="& ActiveDocument.Evaluate("'$(MaxSalesDate)'")
ActiveDocument.Fields("Week").SelectPossible
d.Clear
end sub