?
Solved

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

Posted on 2014-09-15
3
Medium Priority
?
128 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 2000 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

764 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