Solved

Assign Running Count to Period in Date Table

Posted on 2012-03-28
2
592 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 500 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

617 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