Skip to Content
Former Member
Sep 07, 2009 at 02:37 AM

How to count days in month and year in Query



I have problem generate query report on counting days in month and year. My report has only fiscal year/period variable.

The report has a formula where figure need to multiply with days in month and year


Jan Feb March

Inventory (RM) 1000 2000 3000

Cost of Sales (RM) 100 200 300

No. of days in month 31 28 31

No. of days in year 365 365 365

YTD Cost of Sales 100 200100 300200+100

YTD No of Days 31 3128 3128+31

YTD Inventory days (1000/100)31 days [2000/(200+100)](31+28 days)

YTD Inventory turn 365/YTD Inventory days

Formula :

YTD Inventory days = (Monthly inventory / YTD Cost of sales) x YTD No. days in a year

YTD Inventory turns = 365 / YTD inventory days

Please advice me on the solution.

Thank you.