Need help with a formula. I want to limit it to a specific year. I have a from date and a to date field. Can I add an if statement to limit the year

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Here is the formula: Case([Activity Type], "Electricity", [Activity Amount]*[Tracked Locations Site - 2017 Electricity EF], "Diesel" , [Activity Amount]*[Tracked Locations Site - 2017 Diesel EF], "Distillate Fuel Oil", [Activity Amount]*[Tracked Locations Site - 2017 Distillate Fuel Oil EF], "Gasoline", [Activity Amount]*[Tracked Locations Site - 2017 Gasoline EF], "Natural Gas", [Activity Amount]*[Tracked Locations Site - 2017 Natural Gas EF], "HFC 407c", [Activity Amount]*[Tracked Locations Site - 2017 HFC 407c EF], "HFC 410a", [Activity Amount]*[Tracked Locations Site - 2017 HFC 410a EF],).  How do I add an if statement to limit it to dates between 4/1/16 and 3/31/17?

Photo of David

David

  • 0 Points

Posted 3 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
try this:



var number Amount = Case([Activity Type], 

"Electricity", [Activity Amount]*[Tracked Locations Site - 2017 Electricity EF], 

"Diesel" , [Activity Amount]*[Tracked Locations Site - 2017 Diesel EF], 

"Distillate Fuel Oil", [Activity Amount]*[Tracked Locations Site - 2017 Distillate Fuel Oil EF], 

"Gasoline", [Activity Amount]*[Tracked Locations Site - 2017 Gasoline EF], 

"Natural Gas", [Activity Amount]*[Tracked Locations Site - 2017 Natural Gas EF], 

"HFC 407c", [Activity Amount]*[Tracked Locations Site - 2017 HFC 407c EF], 

"HFC 410a", [Activity Amount]*[Tracked Locations Site - 2017 HFC 410a EF]);



IF([My Date Field] >= Date(2016,04,01) and [My Date Field] <= Date(2017,03,31), $Amount, 0)
Photo of David

David

  • 0 Points
It Worked perfectly Thanks