Solved

How can I compare two month totals and show those that are 10% lower than previous month?

Posted on 2014-09-15
3
127 Views
Last Modified: 2014-09-17
The attached query lists each month totals for Cntr.  I want the query to show only months that the Cntr totals were 10% lower than previous month's.
qryComparisonYTD.docx
0
Comment
Question by:softsupport
[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
3 Comments
 
LVL 25

Expert Comment

by:chaau
ID: 40324405
can you please show some sample data. It is unclear what values are in your qryClaimComparisonYTD.[ClaimDate] column for each row
0
 

Author Comment

by:softsupport
ID: 40325674
Sample data attached.  Query lists total for each month.  I want to compare current months totals to the previous month and show if totals are 10% lower.
dataComparisonYTD.xlsx
0
 
LVL 25

Accepted Solution

by:
chaau earned 500 total points
ID: 40326904
Thanks for the sample data. It really helped. This query will give you the desired result:
SELECT Prev.[Center_Center Id], Prev.[Center Name], 
Prev.[CenterClaim_Center Id], Prev.ClaimDate, 
Prev.CenterTotalClaimed, Curr.ClaimDate, 
Curr.CenterTotalClaimed
FROM qryMealsClaimComparisonYTD AS Prev INNER JOIN qryMealsClaimComparisonYTD AS Curr 
ON (Prev.[CenterClaim_Center Id] = Curr.[CenterClaim_Center Id]) AND (Prev.[Center_Center Id] = Curr.[Center_Center Id])
WHERE ((([Prev].[ClaimDate]+1)=DateAdd("m",-1,[Curr].[ClaimDate]+1)) AND ((Curr.CenterTotalClaimed)<=[Prev].[CenterTotalClaimed]*0.9));

Open in new window

You can adjust the percentage by modifying the last parameter "[CenterTotalClaimed]*0.9". At the moment it is "*0.9" but you can make it 0.8 for 20%
This is the results of this query:
Query Result
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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