Ramco Ramco

Ramco Ramco

  • 1k
  • 1.5k
  • 125.7k

Average Calculation

Nov 19 2022 4:04 PM

Hi

  I have below query & i want to get average by dividing total no days by total no of entries

  select sum([TotDays]),month([InvoiceDate]),year([InvoiceDate]) FROM [Sales] 
  where [InvoiceDate] between DATEADD(month, -12, GETDATE()) and GETDATE()
  group by year([InvoiceDate]),month([InvoiceDate])

Thanks


Answers (1)