Issues in Calculating Weeks

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am deriving store launch date by using following in a formula field. 

Launch/Relanch: If(

[Banner] <> "Woolworths", [Building Comp Date],

not IsNull([Marketing Launch]), [Marketing Launch],

WeekdayAdd([Approved Completion Date],14))

As I needed to get 'week to launch', I used the following formula. 

Weeks to Laumch: ToWeeks (Launch/Relaunch) 

But I could not get this working.  Then I decided to use a different approach by calculating launch/relaunch date as well as weeks in the same formula by using the following and it still does not work for me.  


Weeks to Launch: If(

[Banner] <> "Woolworths", ToWeeks([Building Comp Date])-Today(),

not IsNull([Marketing Launch]), ToWeeks([Marketing Launch])-Today(),

ToWeeks(WeekdayAdd([Approved Completion Date]),14)-Today())

Not too sure what is need to calculate weeks? 
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
When you say it is not working, what are the symptoms of the problem.
Mark
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks Mark. It says function is defined to be in ToWeeks(Duration d).  You may need to do one of the following: Choose the right number and type of agreement etcetc./
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
I think it's misplaced brackets on the first two lines.
try this

 If(
[Banner] <> "Woolworths", ToWeeks([Building Comp Date]-Today()),

not IsNull([Marketing Launch]), ToWeeks([Marketing Launch]-Today()),

ToWeeks(WeekdayAdd([Approved Completion Date]),14)-Today())
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks. Tried it. Now I am getting an issue with Weekdayadd function.  Bad or missing arguments in function call.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
This should work
 If(
[Banner] <> "Woolworths", ToWeeks([Building Comp Date]-Today()),

not IsNull([Marketing Launch]), ToWeeks([Marketing Launch]-Today()),

ToWeeks(Days(WeekdayAdd([Approved Completion Date]),14)-Today()))
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thank you kindly.  But I still have the same error. Could this be that approved completion date is a formula date field?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
No, that is not why.  Can you post your exact formula?
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks.  So the field is numeric:

 If(
[Banner] <> "Woolworths", ToWeeks([Building Comp Date]-Today()),

not IsNull([Marketing Launch]), ToWeeks([Marketing Launch]-Today()),

ToWeeks(Days(WeekdayAdd([Approved Completion Date]),14)-Today()))
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
more problems with placement of brackets

If(
[Banner] <> "Woolworths", ToWeeks([Building Comp Date]-Today()),

not IsNull([Marketing Launch]), ToWeeks([Marketing Launch]-Today()),

ToWeeks(
Days(
WeekdayAdd([Approved Completion Date],14)-Today()
)))
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks. Still the same error. ad or missing arguments in function call.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
Can you send me a link.  Its hard I guess to debug without access to the formula itself.
Mark
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks. Sending you by email