Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assign Running Count to Period in Date Table

Posted on 2012-03-28
2
Medium Priority
?
602 Views
Last Modified: 2012-06-21
I have a date table that I need to assign a running count on the "Fiscal_Year_And_Period" column in order to do look back calculations like last 13 periods average, last 6 periods average, last 3 period average, and current period within the same query. I know i can use a CASE expression to do the calcs if a period is within 13 periods of the current period, but I run into problems when those periods extend into the prior year. I have attached a spreadsheet showing the table I have to work with and highlighted in yellow the column I need created (want to use a CTE if possible). Please let me know if furthur clarification is needed.
Calendar.xlsx
0
Comment
Question by:nirajkrishna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 37780306
You can get your value as follows: year*13+period -2008*13
0
 

Author Closing Comment

by:nirajkrishna
ID: 37780324
Now that is one way I never thought of solving it. Very nice!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Viewers will learn how the fundamental information of how to create a table.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question