Hi guys,
can any body help me in creating a query item "current week" using a query item called " inv_end_date".(i need the logic for 'current week')
What is the logic for Current week? All 7 days or 5 days?
You can use this function to get the current week of the year.
_week_of_year(inv_end_date)
thank you, the logic is for all 7 days.week is from MON-SUN.I need to calculate the 'last 4 weeks' data item using the 'inv_end_date'.can you tell the following code is correct or not
_add_days(_week_of_year(inv_end_date),-28)
_add_days() expects a date as input , the _week_of_year has a numeric value as output.
Why not
_add_days(inv_end_date,-28) ?
I second blom0344.
Keep in mind that this will give you rolling 28 days data.
If your objective is to get 4 weeks data till the start of current week, then it adds some more calculations.
Quote from: Suraj Neupane on 24 Jan 2008 11:58:34 AM
I second blom0344.
Keep in mind that this will give you rolling 28 days data.
If your objective is to get 4 weeks data till the start of current week, then it adds some more calculations.
HI ,
can you tell me what other calculations i need to add to get exact 4 weeks of data
Quote from: sspk on 25 Jan 2008 10:36:20 AM
HI ,
can you tell me what other calculations i need to add to get exact 4 weeks of data
It all depends on how you define exact 4 weeks.
If the week runs from monday to sunday , then use _day_of_week(date,1) to establish the daynumber of the date.
Say, the date is friday, then this yields 5.
The exact 4 whole weeks would be:
between (_add_days(date,-28-_day_of_week(date,1)) and
_add_days(date,0-_day_of_week(date,1)))