<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title></title>
	<atom:link href="https://theaccessbuddy.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://theaccessbuddy.wordpress.com</link>
	<description></description>
	<lastBuildDate>Fri, 14 Apr 2017 11:15:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">20052358</site><cloud domain='theaccessbuddy.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://secure.gravatar.com/blavatar/56a968fc37c01e2946092e5b32f66f3f5ff46502d5bf9310455a1f203794e0b4?s=96&#038;d=https%3A%2F%2Fs2.wp.com%2Fi%2Fwebclip.png</url>
		<title></title>
		<link>https://theaccessbuddy.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://theaccessbuddy.wordpress.com/osd.xml" title="" />
	<atom:link rel='hub' href='https://theaccessbuddy.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Quick way to Import Multiple Excel Files into MS Access</title>
		<link>https://theaccessbuddy.wordpress.com/2017/04/14/quick-way-to-import-multiple-excel-files-into-ms-access/</link>
					<comments>https://theaccessbuddy.wordpress.com/2017/04/14/quick-way-to-import-multiple-excel-files-into-ms-access/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Fri, 14 Apr 2017 11:12:00 +0000</pubDate>
				<category><![CDATA["MS Access"]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[Import Export]]></category>
		<category><![CDATA[Microsoft Access]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[MS Access Query]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=435</guid>

					<description><![CDATA[Recently, I had requested a big size of sales/inventory data from one of our internal team. While the data was available at a reasonable level of detail, it was too big to come in one spreadsheet. So, the concerned data &#8230; <a href="https://theaccessbuddy.wordpress.com/2017/04/14/quick-way-to-import-multiple-excel-files-into-ms-access/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">Recently, I had requested a big size of sales/inventory data from one of our internal team. While the data was available at a reasonable level of detail, it was too big to come in one spreadsheet. So, the concerned data operator gave me the data in multiple spreadsheets (MS Excel) with each spreadsheet of significant file size running into 100s of MBs. When I went through the data, I realised I might have to add some helper columns to add some more details – but doing so in each and every spreadsheet was going to be too time consuming. So, I started thinking of importing these multiple files into a single table of MS Access, then run queries as per my needs. <img style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image.png?w=524&#038;h=395" width="524" height="395">  </p>
<p align="justify">In this post, you&#8217;ll learn about this <strong>in-built Macro function</strong> in MS Access to import data known as “<font color="#333333">ImportExportSpreadsheet</font>”. </p>
<p><span id="more-435"></span></p>
<h1><strong>Business Scenario </strong></h1>
<p align="justify">Let&#8217;s say you have received a set of data in 25 different spreadsheets. Each spreadsheet has say 26 fields. Now, instead of working on each of the 25 sheets individually, you want to import them into a single Access file. This way you would then have to work on just one big set of data.  </p>
<p align="justify">So, one way of doing that was to import the data using the wizard under the &#8220;External Data&#8221; tab of the application but soon I realised that it was too slow. Further, I did not have much time or inclination to write a macro code to facilitate this import (major reason – I didn&#8217;t know how to!).  </p>
<p align="justify">So, finally I came across a <u>built-in</u> Macro function in MS access that helped me to import the file. It was significantly faster than the wizard and probably slower than any code – but at least I was not required to know or write any code.  </p>
<p align="justify">So, lets get started with the steps required to start using this function to import data.  </p>
<h1>Step 1 – Create Empty Destination Table </h1>
<p><strong>Step 1:</strong> Let say you have received the following sample data:  </p>
<p><img style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml199b810.png?w=1372&#038;h=534" width="1372" height="534">  </p>
<p>Examine the files and list down the columns as well as the data type of the data under each field.  </p>
<p>Based on the data provided, list down the columns and the data types separately in a notepad/excel. This is important since you are going to need these column names and datatypes while creating a new empty table in MS Access.  </p>
<p><img style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml1ddd82.png?w=638&#038;h=570" width="638" height="570">  </p>
<p>&nbsp; </p>
<h4>Background work: </h4>
<p align="justify">Just to be on the safer side, you need to make note of the following things (these points will serve as checkpoints to see whether or not data transfer has taken place correctly):  </p>
<ol>
<li>
<div align="justify">Make a note of the number of records of data in each of the spreadsheet (in this case 25). So, if there are n-records in each file, the final access table should have 25n records. </div>
<li>
<div align="justify">It is advisable to check whether a particular field in each of the 25 sheets holds the data of the same datatype. For e.g.: values in Date_Field in 24 sheets could be of the type date but in the 25th file it might be stored as a text. Such differences can introduce errors while importing the data. You just have to ensure that the data that you are importing is uniform. </div>
</li>
</ol>
<p align="justify">Once you have examined and confirmed the file structure, fields and the datatypes of each field, you will now create an empty Access table as follows:  </p>
<ol>
<li>
<div align="justify">You can either create it using a GUI (i.e. create query in query design grid) – but that would be a bit tedious given that you need to create 26 fields. </div>
<li>
<div align="justify">Instead you will create a SQL query as follows using Create &#8220;Query Design&#8221; function. On clicking Create Query, the query design grid will open. You need to again right click on the open query grid (as shown) and switch to SQL view. </div>
</li>
</ol>
<p><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtmlec20ec.png?w=1202&#038;h=408" width="1202" height="408"><br />In the SQL view, then type the above code. The SQL windows will now look as follows: </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image1.png?w=299&#038;h=438" width="299" height="438">  </p>
<p>Before hitting the Run Option, make sure you first Save the query. On clicking Run, you’ll find that a new Table has been created.  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml1fff550.png?w=1225&#038;h=557" width="1225" height="557">  </p>
<p>Before you start the data transfer, do a quick check to see if the final table created is as expected. As can be seen from above, the table has indeed been created as expected.&nbsp; </p>
<h1>Step 2 – Setup Data Import Macro </h1>
<p>Now that you have created the empty table, you’ll start the data import process.  </p>
<p>Go to Create and Click on “Macro” under “Macros &amp; Code”.  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image2.png?w=940&#038;h=113" width="940" height="113">  </p>
<p>A new screen will pop-up as shown below:  </p>
<p>Under the “Design” tab of the new screen, you’ll find that “Action Catalog” is activated by default. In addition to that, you also have to activate “Show All Actions” by clicking on it once.  </p>
<p>After doing so, on the right hand side “Action Catalog” window, locate the option “ImportExportSpreadsheet” and double click on it. (Note: If “Show All Actions” is not clicked, you won’t find the option “ImportExportSpreadsheet”.)  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml2e3015.png?w=1941&#038;h=670" width="1941" height="670">  </p>
<p>Once you can see the &#8220;ImportExportSpreadsheet&#8221;, you need to double click it. After double clicking it, you’ll see a small pop-up in the new screen that will ask you to provide the following details:  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml621630.png?w=872&#038;h=605" width="872" height="605">  </p>
<div style="line-height:normal;" align="center">
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Transfer Type</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">You need to specify whether you need to Import or Export. In this example, you’ll transferring data from multiple excel sheets into ACCESS. Hence, you’ll choose Import.</font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Spreadsheet Type</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Select “Excel Workbook”.</font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Table Name</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Specify the name of the new empty Table Created in Step 1.</font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">File Name</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Specify the complete pathname of the file that you want to import along with the filename with its extension.</font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Has Field Names</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">In this example, each of the 25 files has field names. So, choose “YES”.</font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="133">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Range</font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="308">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="justify"><span><font style="font-size:10.5pt;">Since you want to import the entire data, leave this blank.</font></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>Note that, since you need to import 25 different files into the Access table, you can go about it in the following two ways:  </p>
<ol>
<li>
<div align="justify">As described above, you first need to specify the filename of the first file, save the Macro and then Click Run. Likewise, you need to do for all the 25 files – just edit the filename and click run. In this case, you’ll be clicking RUN option 25 times. But this is not advisable. I&#8217;d rather give instructions to import 25 files only once and then have myself click &#8220;Run&#8221; just once every time I need to import the 25 files.&nbsp; </div>
<li>
<div align="justify">Under the new Macro Window, you’ll click “ImportExportSpreadsheet” 25 times so that you now have 25 windows open within the Macro Screen. Or Copy the first windows (Ctrl+C) and then (Ctrl+V) 24 times. Here, you can also specify which file should be imported first. In this case, you’ll have to Run the query only once. </div>
</li>
</ol>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml838393.png?w=1210&#038;h=918" width="1210" height="918"> </p>
<p>On Clicking save, you&#8217;ll see that the macro has been created. If you want to edit the macro in future, you can do so by right clicking it and by choosing the design view (just like you do for any query or table).&nbsp;&nbsp; <img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image3.png?w=215&#038;h=277" width="215" height="277">  </p>
<p>Just before you Click Run, you can add a custom message to notify you when the data import is complete. It can be done as follows:  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml9cf9bc.png?w=1191&#038;h=799" width="1191" height="799">  </p>
<p>Save the Macro and name it as you like. Then Click on Run and the data transfer/import should begin.  </p>
<p>Once the data transfer is complete, the customised message will pop-up indicating that the process is complete.  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image4.png?w=747&#038;h=247" width="747" height="247">  </p>
<p>&nbsp; </p>
<p>And once the data transfer is complete, you can go to the table to do a quick sense check.  </p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Quick way to Import Multiple Excel Files into MS Access" border="0" alt="Quick way to Import Multiple Excel Files into MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtmla22f9a.png?w=1191&#038;h=802" width="1191" height="802">  </p>
<h1>Alert: Error &amp; Exceptions </h1>
<p align="justify">Now, here&#8217;s a homework for you guys.  </p>
<p align="justify">While importing the data, it does happen that you might set a field to a particular datatype but the the data that is actually getting imported might be of a different datatype in few rows – either due to some error or an oversight in the data source.</p>
<p align="justify">E.g.: Let&#8217;s say you have a column &#8220;StorageBinNo&#8221; which is set as a &#8220;Text&#8221; datatype. And in few rows of that field there are numbers or dates present in the source data. So, while importing the data, MS Access will try to convert these number and dates and store them as text. </p>
<p align="justify">However, in some cases, MS access will not be able to successfully convert data types into a datatype that the field is set to in the table. A quick example would be&nbsp; trying to import &#8220;Text&#8221; in a field set as &#8220;Date&#8221;. The tool will not able to import text and save it as&nbsp; a date.</p>
<p align="justify">In such cases, after the import is complete, Access will create a table titled &#8220;<strong>Field1$_ImportErrors</strong>&#8221; and it would specify the Error (i.e. Type Conversion Error), Field name in which the error is encountered and the row number.</p>
<p align="justify">In conclusion, be mindful if there are any errors in the data source. These will be handled in the following two ways: </p>
<ol>
<li>
<div align="justify">Access will indicate errors by listing the errors in an another table. The cell that it shows has errors will contain no data. </div>
<li>
<div align="justify">There will be no visible notification but there can be critical data loss. This is one thing that you need to be extremely mindful of while running data imports. </div>
</li>
</ol>
<p align="justify">Given that there are following most commonly datatypes used in MS Access, I would want you to experiment a bit and try to import different datatypes into fields of some other datatype.&nbsp; So, create a field of &#8220;Currency&#8221; Datatype and try importing text, long, date etc. and share your observations with everyone here in the comments section.</p>
<ol>
<li>
<div align="justify">Memo</div>
<li>
<div align="justify">Byte</div>
<li>
<div align="justify">Integer</div>
<li>
<div align="justify">Long</div>
<li>
<div align="justify">Single</div>
<li>
<div align="justify">Double</div>
<li>
<div align="justify">Currency</div>
<li>
<div align="justify">Date/Time</div>
</li>
</ol>
<h1>Warning! </h1>
<p align="justify">Importing data to Access may not be as straight-forward as it looks. On the contrary, it could be risky if you are not careful enough with the data types. Sometimes, you may not even get an error though the data transfer has not occurred as you expected. Keep an open eye for such fields that contain multiple data types.  </p>
<h1>Summary </h1>
<p>In this way you can import multiple excel files into a single Access Table. Please try to run this macro on you own and let our readers know whether you face any problems. Also, keen to know whether this method is helpful or whether you still prefer using the data import wizard.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2017/04/14/quick-way-to-import-multiple-excel-files-into-ms-access/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">435</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml199b810.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml1ddd82.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtmlec20ec.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image1.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml1fff550.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image2.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml2e3015.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml621630.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml838393.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image3.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtml9cf9bc.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/image4.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2017/04/snaghtmla22f9a.png" medium="image">
			<media:title type="html">Quick way to Import Multiple Excel Files into MS Access</media:title>
		</media:content>
	</item>
		<item>
		<title>Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</title>
		<link>https://theaccessbuddy.wordpress.com/2014/12/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-2-of-2/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/12/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-2-of-2/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Fri, 19 Dec 2014 12:37:35 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[ABC Analysis]]></category>
		<category><![CDATA[Cumulative Sum]]></category>
		<category><![CDATA[DSUM]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Pareto Analysis]]></category>
		<category><![CDATA[Rolling Sum]]></category>
		<category><![CDATA[Running Total]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=417</guid>

					<description><![CDATA[In the previous post, you have learnt how to perform ABC analysis/Pareto analysis using the DSUM function. By now, after reading that post you must have realised that there were no product categories in the previous data – as a &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/12/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-2-of-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">In the previous <a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/" target="_blank">post</a>, you have learnt how to perform ABC analysis/Pareto analysis using the DSUM function. By now, after reading that post you must have realised that there were no product categories in the previous data – as a result of which all the SKUs (regardless of their product categories) that contributed to top 80% of the sales were classified as A class items. Now, it is quite possible that a particular SKU could have sales <u>not</u> in the top 80% of the overall sales but in the top 80% of the category sales that it belongs to. In order words, you would want each categories to have its own A , B &amp; C Class SKUs. This requirement is a simple extension of the following two posts:</p>
<ol>
<li>
<div align="justify"><a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/" target="_blank">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</a> and</div>
<li>
<div align="justify"><a href="https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/" target="_blank">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) – Part 2 of 2</a></div>
</li>
</ol>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image.png?w=477&#038;h=261" width="477" height="261"></p>
<p>&nbsp;</p>
<p>Let us see how…</p>
<p><span id="more-417"></span></p>
<h1>Real Life Scenario</h1>
<p align="justify">You have now received category wise SKU sales data and your manager wants you to run an ABC analysis such that each category will have its own A,B &amp; C&nbsp; class. Just when you thought that you can handle this request, it strikes you that in this particular case, there are categories involved. You realise that the new ABC analysis would require you to tweak the query, but you just cant figure out how?</p>
<p align="justify">You simply stare at the data in front of you and keep on thinking…..</p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image1.png?w=665&#038;h=615" width="665" height="615"></p>
<p>&nbsp;</p>
<h1>Classifying ABC across each category</h1>
<p align="justify">As we have seen by now, whenever you want to make use of DSUM() function to come up with a running total, you need to prepare the data by first sorting the data in descending order and then adding an extra column of unique values. This column of unique values will act just as a helper column while constructing the DSUM() function. In this case you&#8217;ll be using a &#8220;Make Table&#8221; query.</p>
<p><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image2.png?w=1058&#038;h=512" width="1058" height="512"></p>
<p align="justify">On clicking the &#8220;Run&#8221; option, a new table will be created as follows but without a column of unique values:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml8c4980.png?w=1082&#038;h=662" width="1082" height="662"></p>
<p align="justify">On saving the above changes, the new table will be created as follows:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml8de9d4.png?w=858&#038;h=801" width="858" height="801"></p>
<p align="justify">Once you have the new table ready in the above format, you need to create a query on this table in order to&nbsp; calculate the running total:</p>
<h5>Step1:</h5>
<p align="justify">Running total/Cumulative Sum – Here, you will construct a DSUM function with a criteria, as shown below:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image3.png?w=696&#038;h=214" width="696" height="214"></p>
<h5>Step 2:</h5>
<p align="justify">Running Total%/Cumulative Sum% – Here, first you will create a helper column containing the total category value across the corresponding category&#8217;s record. Then using this helper column and the running total column above, you will calculate Running Total% (or CumPerc) by making use of a simple division&#8221;/&#8221; operator.</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml10f11c1.png?w=602&#038;h=468" width="602" height="468"></p>
<h5>Step 3:</h5>
<p align="justify">ABC Classification – Here, using a IIF() function you&#8217;ll classify each SKU into A/B/C class such that top 80% will be A class, next 15% will be B class and the remaining 5% will be classified C class.</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml11524b4.png?w=470&#038;h=204" width="470" height="204"></p>
<p align="justify">The final query would look like as follows:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image4.png?w=1057&#038;h=520" width="1057" height="520"></p>
<p align="justify">On running the overall query, you will get the following result:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image5.png?w=788&#038;h=970" width="788" height="970"></p>
<h1 align="justify">Summarising the Results</h1>
<p align="justify">Now that you have the classification ready, you just need to create another query based on the above query to summarise the results just like you did in the <a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/" target="_blank">previous post</a>.</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image6.png?w=1717&#038;h=471" width="1717" height="471"></p>
<p align="justify">On running the query, you&#8217;ll get the final summary as follows:</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" border="0" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]" align="left" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml187e289.png?w=1097&#038;h=323" width="1097" height="323"></p>
<h1 align="justify">Next Steps:</h1>
<p align="justify">Please practice this and previous <a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/" target="_blank">post</a>, create similar queries using your data and share the results with all our readers.</p>
<p align="justify">If you are facing any problem understanding this post, it is probably a good idea to go through the following post to refresh the basics:</p>
<ul>
<li><a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function –The Art of Writing a Criteria : 1</a>
<li><a href="https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/" target="_blank">DSUM() function –The Art of Writing a Criteria : 2</a>
<li><a href="https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/" target="_blank">DSUM() function –The Art of Writing a Criteria : 3</a>
<li><a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">Using MS Access to create a Running Total or a Cumulative Sum – Part 1 of 2</a>
<li><a href="https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/" target="_blank">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) – Part 2 of 2</a>
<li><a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/" target="_blank">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/12/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-2-of-2/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">417</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image1.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image2.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml8c4980.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml8de9d4.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image3.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml10f11c1.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml11524b4.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image4.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image5.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/image6.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/12/snaghtml187e289.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 2 of 2]</media:title>
		</media:content>
	</item>
		<item>
		<title>Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</title>
		<link>https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Wed, 19 Nov 2014 17:46:33 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[ABC Analysis]]></category>
		<category><![CDATA[Cumulative Sum]]></category>
		<category><![CDATA[DSUM]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Pareto Analysis]]></category>
		<category><![CDATA[Rolling Sum]]></category>
		<category><![CDATA[Running Total]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=398</guid>

					<description><![CDATA[In this post, you will be learning to perform ABC analysis using the DSUM() function. There are instances when a small percentage of causes in your business lead to a large percentage of impacts – meaning that drawing your focus &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">In this post, you will be learning to perform <strong>ABC analysis using the DSUM() function</strong>. There are instances when a small percentage of causes in your business lead to a large percentage of impacts – meaning that drawing your focus on these small percentages of causes could help you have better control over the large percentage of impacts.</p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image.png?w=477&#038;h=261" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="477" height="261" align="left" border="0" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Now, Let us understand how we can use the DSUM() function that we have already learnt to perform ABC/Pareto Analysis….</p>
<p><span id="more-398"></span></p>
<h1>Work Scenario</h1>
<p align="justify">You are working on analysing the inventory of your company. <span style="color:#333333;">The objective is to identify key SKUS out of the many SKUs that are worth focusing.</span> One efficient way to do this is by running an ABC Analysis. Given the large dataset that needs to be analysed, you wonder how you can accomplish this using MS Access……</p>
<h1>What is Pareto Analysis?</h1>
<p align="justify">Pareto Analysis is an analysis technique based on the idea that only a small percentage of “<b><span style="text-decoration:underline;">causes</span></b>” normally lead to a large percentage of “<b><span style="text-decoration:underline;">effects</span></b>”. It is commonly referred to as a “80-20” rule. It means that in most of the activities, 80% of the effects are caused by only 20% of causes. Note that the number 80-20 is to be taken as a thumb-rule. It is important to understand that the real essence of this technique is to identify those small numbers of factors (not necessarily 20%) that are leading to a bulk of the effects (not necessarily 80%).</p>
<p align="justify">Some of the few examples of Pareto Analysis are:</p>
<ul>
<li>
<div align="justify">20% of the Products accounting for 80% of the company’s sales revenue. So, it makes sense that the management should focus its attention on 20% of these products.</div>
</li>
<li>
<div align="justify">15% of the features in a software causing 82% of the bugs. This way the product manager can direct the quality team and the engineers to focus on those 15% of the features.</div>
</li>
<li>
<div align="justify">22% of the SKUs in the inventory accounting for 85% of the materials requests from the production department. This information can enable the procurement/inventory department to maintain reasonable level of stock for these 22% of the SKUs.</div>
</li>
</ul>
<p align="justify">As you can see from the above examples, Pareto Analysis has its applications in a wide variety of fields.</p>
<h1>ABC Analysis – An extension of Pareto Analysis</h1>
<p align="justify">In inventory management or in SCM in general, ABC Analysis is commonly used to classify or categorize inventory in three different classes – A Class, B Class and C Class. &#8216;A&#8217; class items are those that account for 80% of the effects, &#8216;B&#8217; Class are those that account for 15% of the effects whereas &#8216;C&#8217; Class items account for the bottom 5% of the effects.</p>
<p align="justify">Example: A warehouse may classify all its SKUs based on daily average sales such that:</p>
<ul>
<li>
<div align="justify">A Class SKUs &#8211; The ones accounting for 80% of the average daily sales will be classified as A Class SKUs i.e. Fast Moving SKUs.</div>
</li>
<li>
<div align="justify">B Class SKUs &#8211; The ones accounting for the next 15% of the average daily sales will be classified as B Class SKUs i.e. Medium Moving SKUs.</div>
</li>
<li>
<div align="justify">C Class SKUs &#8211; The ones accounting for the bottom 5% of the average daily sales will be classified as C Class SKUs i.e. Slow Moving SKUs.</div>
</li>
</ul>
<p align="justify">On classifying these SKUs, you’ll often find that out of the total SKUs that are in the warehouse inventory, a very small number of SKUS will be A Class items and yet would be accounting for 80% of the average daily sales. Also, there would be large number of SKUs in the inventory accounting for just 5% of the average daily sales.</p>
<p align="justify">So, it naturally makes sense for the management to direct their focus on these small percentage but high impact A Class items and sort of spend less resources on managing the C Class SKUs.</p>
<h1>Steps to Run ABC Analysis</h1>
<p>When you receive the data, you first need to identify the following two things:</p>
<ol>
<li>
<div align="justify">The items in the data that you want to categorise as Class A,B or C. The items could be SKUs, products, customers or product features</div>
</li>
<li>
<div align="justify">The items in the data <span style="text-decoration:underline;">on the basis of which</span> you want to classify – these could be sales (categorising SKU or products on the basis of their sales) or purchases requests (categorising the customers on the  basis of the purchase requests they make and so on).</div>
</li>
</ol>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image1.png?w=628&#038;h=362" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="628" height="362" border="0" /></p>
<p align="justify">Note that for ABC Analysis, you will be categorising data starting with the highest value down to the lowest value such that top x% of the data will fall in highest category and the bottom x% will fall in the lowest category.</p>
<p align="justify">So, once you get the data follow the following Steps:</p>
<ol>
<li>
<div align="justify">Create a query to arrange the data in descending Order.</div>
</li>
<li>
<div align="justify">After this you need to Auto number the data. So, create a table based on the above query using a &#8220;Make-Table&#8221; query. (Note that we are doing this step to avoid the Running Sum error in case there are duplicate values in column [AverageDailySales]</div>
</li>
</ol>
<p>To know more, please refer the post: <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">Using MS Access to create a Running Total or a Cumulative Sum – Part 1 of 2</a></p>
<p>Once you have the new table ready, you&#8217;ll now have the data in the following format:<img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image2.png?w=877&#038;h=409" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="877" height="409" border="0" /></p>
<p>In order to perform ABC Analysis, you need to perform the following steps on the above table:</p>
<p><strong><span style="text-decoration:underline;">STEP 1</span> :</strong> Calculate the Cumulative Sum or Running total using the DSUM function (See previous post for Steps)</p>
<p><a name="_GoBack"></a></p>
<p><img loading="lazy" style="margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtml71f068.png?w=1285&#038;h=437" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1285" height="437" border="0" /></p>
<p align="justify"><strong><span style="text-decoration:underline;">STEP 2</span> :</strong> Calculate Cumulative Percentage – In this step, you need to determine each record forms what percentage of the total AverageDailySales. So, this step 2 will consists of two sub-steps as follows:</p>
<ul>
<li>
<div align="justify"><strong>Step 2a</strong> – Calculate the grand total of the field [AverageDailySales] and display that result across each record.</div>
</li>
<li>
<div align="justify"><strong>Step 2b</strong> – Across each record, calculate the running total will be what percentage of the total AverageDailySales.</div>
</li>
</ul>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image3.png?w=1263&#038;h=447" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1263" height="447" border="0" /></p>
<p>On running the above query:<img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtmle902071.png?w=1014&#038;h=433" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1014" height="433" align="left" border="0" /></p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration:underline;">STEPS3:</span></strong> Classify into A-B-C Classes using IIF() statement – Once you have the cumulative percentages, you would now want to classify the SKUs such that the top 80% (starting from the topmost record) would be A Class, the next 15% (i.e. from 80% to 95%) would be B Class whereas the bottom 5% (i.e. from 80% to 95%) would be C Class items.</p>
<p align="justify">In this case, you will make use of an <strong><span style="text-decoration:underline;">IIF() function</span></strong>. An IIF() function is a simple function. This function tests for a particular condition as provided by the user. If the condition is TRUE, then it provides a value as specified by the user. If the condition is FALSE, even then it provides a value as specified by the user. As you might have noticed, the user needs to specify the &#8220;Condition&#8221;, and the value to be returned if the condition is TRUE or FALSE. In fact, instead of providing the  value, you can also provide a Nested IIF() function that would RUN, if the values are TRUE or FALSE.</p>
<p align="justify"><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image4.png?w=1095&#038;h=140" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1095" height="140" border="0" /></p>
<p>Now using this IIF() function in the query as follows:</p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image5.png?w=782&#038;h=226" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="782" height="226" border="0" /></p>
<p>On Running this query, you get the final result as follows:</p>
<p><img loading="lazy" style="margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtml62d9a5b.png?w=1026&#038;h=870" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1026" height="870" border="0" /></p>
<h1><b>Summarize Results:</b></h1>
<p align="justify">The only final thing you would now like to know from the above result is a small table summarising:</p>
<ol>
<li>
<div align="justify">The number of SKUs that fall within each class (A, B or C) and their contribution (in%) to overall sales.</div>
</li>
<li>
<div align="justify">And sales contributed by each category and its percentage to the total sales.</div>
</li>
</ol>
<p align="justify">So, in short you are looking at a result something like shown below:</p>
<div style="line-height:normal;" align="center">
<table class="MsoTableGrid" style="border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:0 5.4pt;border:windowtext 1pt solid;" valign="top" width="44">
<p class="MsoNoSpacing" style="margin:0;"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Class</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="88">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Total SKUs</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="78">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">SKU Split</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="90">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Total Sales</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="96">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Total Sales %</span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="44">
<p class="MsoNoSpacing" style="margin:0;"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">A</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="88">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">X</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="78">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">X%</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="90">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">M</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="96">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">M%</span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="44">
<p class="MsoNoSpacing" style="margin:0;"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">B</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="88">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Y</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="78">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Y%</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="90">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">N</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="96">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">N%</span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="44">
<p class="MsoNoSpacing" style="margin:0;"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">C</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="88">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Z</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="78">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Z%</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="90">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">O</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="96">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">O%</span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="44">
<p class="MsoNoSpacing" style="margin:0;"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">Total</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="88">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">(X+Y+Z)</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="78">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">100%</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="90">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">(M+N+O)</span></span></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="96">
<p class="MsoNoSpacing" style="margin:0;" align="center"><span lang="EN-IN"><span style="font-family:Calibri;"><span style="font-size:11pt;color:#000000;">100%</span></span></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p align="justify">Since, you already know that there were total 195 SKUs under analysis, (X+Y+Z) should be equal to 195 and roughly a small percentage of X should account for a relatively large percentage of M &#8211; thereby validating that indeed A class SKUs are those small % of SKUs that account for a relatively high percentage of total sales.</p>
<p>To do this, you would summarise the above query by writing another query.</p>
<ol>
<li>
<div align="justify">In order to count the SKUs, you could simply select the field that you want to count and in the Total row, select Count OR you could use an expression with function Count ([SKU]). Either ways, you’ll get the same result.</div>
</li>
<li>
<div align="justify">In order to calculate the SKU split %, you would want to divide the number of SKUs in each Class by the total SKUs under consideration. To do so, you’ll use the following formula :<br />
<img loading="lazy" style="background-image:none;margin:10px auto 0;padding-left:0;padding-right:0;display:block;float:none;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image11.png?w=720&#038;h=189" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="720" height="189" border="0" /></div>
</li>
<li>
<div align="justify">Similarly, you can use the same formula to calculate the total sales across class A/B/C as well as the percentage of sales of each class to the total sales.</div>
</li>
</ol>
<p>The query will look as follows:</p>
<p><img loading="lazy" style="margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image6.png?w=1390&#038;h=512" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="1390" height="512" border="0" /></p>
<p>On running the query, you’ll get the following result: <img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image7.png?w=652&#038;h=224" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="652" height="224" align="left" border="0" /></p>
<p>&nbsp;</p>
<p>In order to add a “Total” row, click the option Totals under Home. You should get the following result:</p>
<p><img loading="lazy" style="background-image:none;margin:10px 0 0 7px;padding-left:0;padding-right:0;display:inline;float:left;padding-top:0;border-width:0;" title="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image8.png?w=564&#038;h=258" alt="Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]" width="564" height="258" align="left" border="0" /></p>
<p>&nbsp;</p>
<p align="justify">As you can see, 21.54% of the SKUs account for almost 80% of the sales. More importantly in C Class, there are almost 49% of the total SKUs that account for just 5% of the total sales. You can naturally conclude that it’s better to focus on those small percept of A Class SKUs that account for 80% sales rather than high number of C Class SKUs that account for only 5% of the total sales.</p>
<p align="justify">So, in this way you can run Pareto Analysis/ABC Analysis using MS Access.</p>
<h1><b>Next Steps:</b></h1>
<p align="justify">It is important to note that the above analysis <span style="text-decoration:underline;">does not </span>take into account the product category. This means that there is a possibility that there could be some product categories which may not have any SKUs in A Class at all. But there are instances, when you would want to classify the SKUs in such a way that each product category will have its own ABC class. In the next upcoming post, you’ll learn to run such analysis across different product categories i.e. each product category will have its own ABC Class. <!--EndFragment--></p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/11/19/perform-abc-analysis-pareto-analysis-using-the-dsum-function-part-1-of-2/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">398</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image1.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image2.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtml71f068.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image3.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtmle902071.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image4.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image5.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/snaghtml62d9a5b.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image11.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image6.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image7.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/11/image8.png" medium="image">
			<media:title type="html">Perform ABC Analysis (Pareto Analysis) using the DSUM () function : [Part 1 of 2]</media:title>
		</media:content>
	</item>
		<item>
		<title>Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</title>
		<link>https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Sat, 10 May 2014 20:48:11 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Cumulative Sum]]></category>
		<category><![CDATA[DSUM]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Rolling Sum]]></category>
		<category><![CDATA[Running Total]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=383</guid>

					<description><![CDATA[As you have seen in the previous post, you can easily create a running total on a given set of data. A slight modification can be added to this by making MS Access re-start the running total at certain point &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">As you have seen in the <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">previous post</a>, you can easily create a running total on a given set of data. A slight modification can be added to this by making MS Access re-start the running total at certain point as decided by you.  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image3.png?w=496&#038;h=344" width="496" height="344">  </p>
<p align="justify">In this post, you’ll learn how to do so…. </p>
<p><span id="more-383"></span></p>
<p align="justify">
<h1><b>Work Scenario</b> </h1>
<p align="justify">You have received a similar set of data that you received in the <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">previous post</a>. The only difference is that along with the list of products and their sales in dollars, you now also have the column category that identifies each product.  </p>
<p align="justify">The data that you have received is as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image5.png?w=541&#038;h=537" width="541" height="537">  </p>
<p align="justify">Even here, you want to calculate the running total – BUT you want the tool to restart the running total for every category. i.e. you are expecting the result something like shown below:  </p>
<div style="line-height:normal;" align="center">
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Amount</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Running Total</font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span style="z-index:251679744;position:absolute;margin-top:1px;width:33px;height:159px;margin-left:31px;"><a href="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/clip_image0014.gif"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="clip_image001[4]" border="0" alt="clip_image001[4]" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/clip_image0014_thumb.gif?w=33&#038;h=159" width="33" height="159"></a></span><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100 (Start here)</font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">50</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">150</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">40</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">190</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 4</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">30</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">220</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">225</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">200</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font color="#000000"><font style="font-size:11pt;">200 (</font></font><font style="font-size:11pt;"><span><font color="#ff0000">Re-start </font></span><font color="#000000">here)</font></font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">120</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">320</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">420</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">50</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font color="#000000"><font style="font-size:11pt;">50 (</font></font><font style="font-size:11pt;"><span><font color="#ff0000">Re-start </font></span><font color="#000000">here)</font></font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">40</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">90</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">30</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">120</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 4</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">20</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">140</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">10</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">150</font></font></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<h1><b>Calculating Running Total based on Groups /Category</b> </h1>
<p align="justify">To begin, you’ll follow the same 5 steps that you followed in the <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">previous post (Part 1 0f 2)</a> . The only difference being the way you construct the criteria part of the DSUM () function: </p>
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" width="660">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="61">
<p style="margin:0;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Step 1</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="597">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Create a query based on the given table with the columns that needs to be summed either in descending, ascending or as-is order.</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="61">
<p style="margin:0;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Step 2</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="597">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Create a new table based on the query created in the Step 1 (MAKE TABLE Query)</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="61">
<p style="margin:0;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Step 3</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="597">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Add a new column [No] with data-type Autonumber. Save the table.</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="61">
<p style="margin:0;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Step 4</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="597">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Create a New Query again based on the table created in Step 3 with the required columns in the query design grid and the formula: </font></font></span></p>
<p style="margin:0 0 0 17.1pt;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#ff0000">RT: DSUM (“[Amount]”, “[Table]”, “[Category]=’”&amp;[Category]&amp;”’ AND [No]&lt;=”&amp; [No])</font></font></span><span lang="EN-IN"></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="61">
<p style="margin:0;" class="MsoNoSpacing"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Step 5</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="597">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Run the Query in Step 4 and check the results</font></font></span></p>
</td>
</tr>
</tbody>
</table>
<p>The query will be created as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml30dc245.png?w=1048&#038;h=472" width="1048" height="472">  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml319dfb4.png?w=1044&#038;h=548" width="1044" height="548">  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml32c8ae1.png?w=1040&#038;h=460" width="1040" height="460">  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml343c67a.png?w=1068&#038;h=404" width="1068" height="404">  </p>
<p><strong>Important</strong> : Please note the use of Multiple Criteria in the DSUM() function above. To learn more about it, please read the post : <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function –The Art of Writing a Criteria : 1</a>  </p>
<p>On running the above query, you’ll get the following result.  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &ndash; Part 2 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image6.png?w=1054&#038;h=473" width="1054" height="473">&nbsp; </p>
<p><b></b></p>
<p align="justify">This way, you can get the desired output. Note that in this example, you have sorted the Amount in Descending Order.</p>
<p align="justify">You can similarly create the query by sorting the data in Ascending Order or by just keeping the Amount in as-is order or random order. You will have to make minor changes in the query – <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/" target="_blank">to refresh your memory please read the previous post.</a>&nbsp;</p>
<p><b></b></p>
<h1><b>Summary</b> </h1>
<p>You have now learnt how to create a running total (cumulative sum) whether you are working on a simple list or on a grouped list where you want MS Access to re-start the running total at every new groups.  </p>
<h1><b>Homework</b> </h1>
<p align="justify">I would like you to practice this technique on a new set of data – preferably Northwind database. Practice this technique by keeping the data in all the three sort order &#8211; descending, ascending and as-is order. </p>
<p align="justify">Once you are done, share the learnings<a name="_GoBack"></a> with all by posting comments. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/05/10/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-grouped-data-part-2-of-2/feed/</wfw:commentRss>
			<slash:comments>17</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">383</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image3.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image5.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/clip_image0014_thumb.gif" medium="image">
			<media:title type="html">clip_image001[4]</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml30dc245.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml319dfb4.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml32c8ae1.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml343c67a.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image6.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum (Grouped Data) &#8211; Part 2 of 2</media:title>
		</media:content>
	</item>
		<item>
		<title>Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</title>
		<link>https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Sun, 04 May 2014 13:45:52 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Cumulative Sum]]></category>
		<category><![CDATA[DSUM]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Rolling Sum]]></category>
		<category><![CDATA[Running Total]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=372</guid>

					<description><![CDATA[While analysing data, there are many instances when you need to create a running total (also known as a &#8216;Cumulative Sum&#8217;). In this post, you will learn to create a running total using MS Access Query. Actually, if you know &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">While analysing data, there are many instances when you need to create a running total (also known as a &#8216;Cumulative Sum&#8217;). In this post, you will learn to create a running total using MS Access Query. Actually, if you know how a <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function</a> works, then creating a running total is very easy.  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image.png?w=490&#038;h=344" width="490" height="344">  </p>
<p align="justify">Let’s see how we can use this MS Access function to create a running total using just a query design grid.</p>
<p><span id="more-372"></span></p>
<p align="justify">
<h1><b>Work Scenario</b></h1>
<p align="justify">You have just received a raw data containing a list of products along with its sales volume in dollars. You are in the process of doing different analysis for which you need to create a running total.  </p>
<p align="justify">There are three different ways you want to create a running total:  </p>
<ol>
<li>
<div align="justify">Create a running total with products in <b>descending order</b> i.e. products with the highest sales volume will come first while the lowest will come last. </div>
<li>
<div align="justify">Create a running total with products in <b>ascending order</b> i.e. products with the lowest sales volume will come first while the highest will come last. </div>
<li>
<div align="justify">Create a running total in the <b>given order of products (any random order).</b> </div>
</li>
</ol>
<h1><b>What is a Running Total?? </b></h1>
<p align="justify">Running total is the sum of sequence of numbers in such a way that each <u>new sequence</u> of number is added to the sum of the previous sequence. A better way to understand this is by looking at the example below:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image1.png?w=368&#038;h=178" width="368" height="178"></p>
<blockquote>
<p align="justify">&#8220;One of the advantages of running total is that it helps you to know the total sales made so far at any point of time i.e. in the given example, since you are creating a running total you’ll know the total sales made so far every time a new entry is made&#8221;</p>
</blockquote>
<p align="justify">In short, every time a new record is added, the sale of the new record is added to the sum of all previous records. </p>
<h1><b>Understanding the Data</b></h1>
<p align="justify">The data you have received is as follows:  </p>
<p><img loading="lazy" style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image41.png?w=644&#038;h=525" width="644" height="525"> </p>
<p align="justify">As you can see, there are total 25 products along with their sales volume in dollars (titled &#8216;Amount&#8217;). The data is in a given random order i.e. the sales volume is neither in ascending order nor in descending order.  </p>
<h1><b>Running Total with Product Amount in &#8220;Descending Order&#8221;</b></h1>
<p>Let us begin with the 1<sup>st</sup> point in the scenario.  </p>
<p align="justify">In order to get the products in <u>descending order</u>, you create a Select query by selecting the two columns (fields) that you need. Then apply a descending sort on the column amount as shown in the figure below:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image71.png?w=858&#038;h=508" width="858" height="508">  </p>
<ol>
<li>Select the field Product in the query design wizard.
<li>Then select the field Amount and change the sort order to descending
<li>Add a third field and label it as RunTot. In this field, create a DSUM() expression as follows: </li>
</ol>
<p align="center">RT: DSUM(“[Amount]”, “[Table]”, “[Amount]&gt;=”&amp;[Amount])  </p>
<p align="justify">At every record, the DSUM () examines the criteria and returns the sum of all the records that meet the criteria. So, on running the query you get:  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image11.png?w=839&#038;h=568" width="839" height="568">  </p>
<blockquote>
<p align="justify"><font color="#333333">However, there is an <b><u><font color="#ff0000">exception</font></u></b> here. The above formula <u><font color="#ff0000">will NOT work </font></u>when there are two products with the same value i.e. when there are <u><font color="#ff0000">duplicate values</font></u>. </font></p>
</blockquote>
<p align="justify">Let&#8217;s say that product 14 and product 15 now have equal values (i.e. duplicate values) as shown below:  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image17.png?w=490&#038;h=523" width="490" height="523">  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image22.png?w=640&#038;h=410" width="640" height="410">  </p>
<p align="justify">On running the query on the table with duplicate values, you&#8217;ll get: </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image25.png?w=916&#038;h=587" width="916" height="587"></p>
<p align="justify">As you can see, the DSUM () will return the same result for both the product instead of calculating a cumulative sum or running total. What we really need is that DSUM should add the same amount to the previous total regardless of whether or not they are equal. This is happening because of the way the criteria has been written in the DSUM () function. The criteria make a reference to the same column that contains the duplicate value i.e. in this case it reference to the column [Amount] which also contains duplicate values, thereby returning misleading results. </p>
<h2>Resolving the issue of Duplicate Values</h2>
<p align="justify">In order to avoid this, you need to find a way to add a column that would contain <strong><u>unique numbers</u></strong>. Then, you can create a criteria such that it makes a reference to this column of unique numbers instead of referencing it to the column that contains the duplicate values.&nbsp; </p>
<p align="justify">Now, in MS Access, there is no straight forward &amp; simple way to uniquely number each row in a column. So, there’s a workaround which is explained as below:  </p>
<ol>
<li>
<div align="justify">Create a simple query based on the given data with the field [Amount] in descending order. This is something which you have done earlier also. Save this Query as &#8216;Descending&#8217; (or whatever name you like).<br />&nbsp;<br /><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml5f8bb90.png?w=711&#038;h=469" width="711" height="469"></div>
<li>
<div align="justify">Now, create a new <u>Table</u> based on the above query as shown.This table will be created using a &#8220;<strong>Make Table</strong>&#8221; Query.</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image33.png?w=521&#038;h=465" width="521" height="465"></p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image40.png?w=826&#038;h=560" width="826" height="560"></p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml23c0ee9.png?w=909&#038;h=507" width="909" height="507"></div>
<li>
<div align="justify">On Clicking Run, you&#8217;ll get :<br />&nbsp;<img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml888b0f3.png?w=944&#038;h=621" width="944" height="621">&nbsp;</div>
<li>
<div align="justify">Once you create the table, insert a new column titled ‘No’ and its data type as Autonumber. This will create a table with the same fields that you need along with an additional column that uniquely identifies each record.</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml5c29f39.png?w=1036&#038;h=320" width="1036" height="320"></p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml89169d6.png?w=502&#038;h=581" width="502" height="581"></p>
</div>
<li>
<div align="justify">Once this table is created, then create another query based on this newly created table. The new query should include the following DSUM function. </div>
</li>
</ol>
<p align="center">RT: DSUM (“[Amount]”, “[Table]”, “[No]&lt;=”&amp; [No])  </p>
<p>[Note: The column with Autonumber is in ascending order, hence we are using &lt;= operator. If ever, you already have a unique number column that is descending order, then you can use &gt;= operator in the criteria part of the DSUM () function.]  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image2.png?w=945&#038;h=338" width="945" height="338">  </p>
<p>&nbsp; {For more on DSUM function: Read DSUM () <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">Part 1</a>, <a href="https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/" target="_blank">Part 2</a> and <a href="https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/" target="_blank">Part 3</a>}  </p>
<p>On running this query, you get the following desired result :  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image4.png?w=549&#038;h=557" width="549" height="557">  </p>
<p>So, in short, it is always a good practice to add a unique number column while you are creating a running total.  </p>
<h1><b>Running Total with Product Amount in &#8220;Ascending Order&#8221;</b></h1>
<p><b><u></u></b> </p>
<p align="justify">Creating a running total with products in ascending order is exactly same as descending order except for the comparison operator sign:  </p>
<p align="center">RT: DSUM (“[Amount]”, “[Table]”, “[Amount]&lt;=”&amp; [Amount])  </p>
<p align="justify">At every record, the DSUM () examines the criteria and returns the sum of all the records that are less than or equal to the amount in current row.  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtmlb43bea.png?w=1039&#038;h=487" width="1039" height="487">  </p>
<p align="justify">Again, here too the query will return misleading results if there are duplicate values.  </p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml10136be.png?w=412&#038;h=558" width="412" height="558">  </p>
<p align="justify">Hence, you need to create a new column that uniquely identifies each rows. So, you start by creating queries as mentioned below:  </p>
<ol>
<li>
<div align="justify">Create a simple query based on the given data with the field [Amount] in ascending order now. </div>
<li>
<div align="justify">Now, create a new Table based on the above query as shown. Once you create the table, insert a new column titled ‘No’ and its data type as Autonumber. This will create a table with the same fields that you need along with an additional column that uniquely identifies each record. </div>
<li>
<div align="justify">Once this table is created, then create another query based on this newly created table. The new query should include the following DSUM function. </div>
</li>
</ol>
<p align="center">RT: DSUM (“[Amount]”, “[Table]”, “[No]&lt;=”&amp; [No]) </p>
<p>[Note: The column with Autonumber is in ascending order, hence we are using &lt;= operator. If ever, you already have a unique number column that is descending order, then you can use &gt;= operator in the criteria part of the DSUM () function.] </p>
<p>On running this query, you get the following result as expected: </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml11dc6dc.png?w=1091&#038;h=462" width="1091" height="462"></p>
<h1><b>Running Total with Product Amount in &#8220;</b><b>Random Order or As-Is Order&#8221;</b></h1>
<p>When it comes to creating a running total with the product amounts in random order or as-is order in which they are received, then you need to have another column with unique numbers either in ascending or descending order.  </p>
<p>In this case, now, you need to add a column with unique numbers as done previously. Please check the screenshots below:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" border="0" alt="Using MS Access to create a Running Total or a Cumulative Sum &ndash; Part 1 of 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml79bcac.png?w=1094&#038;h=470" width="1094" height="470">  </p>
<p>In this way, you can create a running total regardless of their sort order or whether they have duplicate values or not.  </p>
<h1><b>Summary</b></h1>
<p>In short, in order to create a running total you need to follow the steps given below:</p>
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" width="574">
<tbody>
<tr>
<td style="border-bottom:windowtext 1.5pt solid;border-left:black 1pt solid;border-top:black 1pt solid;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><b><span><font style="font-size:11pt;" color="#000000">Steps</font></span></b></p>
</td>
<td style="border-bottom:windowtext 1.5pt solid;border-left:medium none;border-top:black 1pt solid;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><b><span><font style="font-size:11pt;" color="#000000">Description</font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span><font style="font-size:11pt;" color="#000000">Step 1</font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNormal"><span><font style="font-size:11pt;">Create a query based on the given table with the columns that needs to be summed either in descending, ascending or as-is order.</font></span><span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span><font style="font-size:11pt;" color="#000000">Step 2</font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNormal"><span><font style="font-size:11pt;">Create a new table based on the query created in the Step 1</font></span><span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span><font style="font-size:11pt;" color="#000000">Step 3</font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNormal"><span><font style="font-size:11pt;">Add a new column [No] with data-type Autonumber. Save the table.</font></span><span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span><font style="font-size:11pt;" color="#000000">Step 4</font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNoSpacing"><span style="line-height:17pt;"><font style="font-size:11pt;" color="#000000">Create a New Query again based on the table created in Step 3 with the required columns in the query design grid and the formula:</font></span></p>
<p style="line-height:17pt;margin:0;" class="MsoNoSpacing" align="center"><b><span style="line-height:17pt;"><font style="font-size:11pt;" color="#000000">RT: DSUM (“[Amount]”, “[Table]”, “[No]&lt;=”&amp; [No])</font></span></b></p>
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span style="line-height:15pt;"><font style="font-size:10pt;" color="#000000">If the values in field [No] are in descending order, use the operator &lt;=</font></span></p>
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span style="line-height:15pt;"><font style="font-size:10pt;" color="#000000">If the values in field [No] are in ascending order, use the operator &gt;=</font></span><span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="73">
<p style="line-height:17pt;margin:0;" class="MsoNormal" align="center"><span><font style="font-size:11pt;" color="#000000">Step 5</font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" valign="top" width="499">
<p style="line-height:17pt;margin:0;" class="MsoNoSpacing"><span style="line-height:17pt;"><font style="font-size:11pt;" color="#000000">Run the Query in Step 4 and check the results.</font></span><span></span></p>
</td>
</tr>
</tbody>
</table>
<p>[Note: The use of domain aggregate function DSUM () can make your query run slow depending on the number of records]  </p>
<h1><b>Next Steps</b></h1>
<p>In the next post, you will learn how to create a running total when the products are categorized and you need to re-start the running total at each category. You want the result to look like as shown in the table below:  </p>
<div style="line-height:normal;" align="center">
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Amount</font></font></span></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Running Total</font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100 (Start here)</font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">50</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">150</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">40</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">190</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 4</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">30</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">220</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">225</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">200</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font color="#000000"><font style="font-size:11pt;">200 (</font></font><font style="font-size:11pt;"><span><font color="#ff0000">Re-start </font></span><font color="#000000">here)</font></font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">120</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">320</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">420</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 1</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">50</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><b><span lang="EN-IN"><font face="Calibri"><font color="#000000"><font style="font-size:11pt;">50 (</font></font><font style="font-size:11pt;"><span><font color="#ff0000">Re-start </font></span><font color="#000000">here)</font></font></font></span></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 2</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">40</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">90</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 3</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">30</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">120</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:medium none;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 4</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">20</font></font></span></p>
</td>
<td style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">140</font></font></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="79">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="91">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product 5</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="63">
<p style="margin:0;" class="MsoNoSpacing"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">10</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="139">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span lang="EN-IN"><font face="Calibri"><font style="font-size:11pt;" color="#000000">150</font></font></span></p>
</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/05/04/using-ms-access-to-create-a-running-total-or-a-cumulative-sum-part-1-of-2/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">372</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image1.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image41.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image71.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image11.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image17.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image22.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image25.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml5f8bb90.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image33.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image40.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml23c0ee9.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml888b0f3.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml5c29f39.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml89169d6.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image2.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/image4.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtmlb43bea.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml10136be.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml11dc6dc.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/05/snaghtml79bcac.png" medium="image">
			<media:title type="html">Using MS Access to create a Running Total or a Cumulative Sum &#8211; Part 1 of 2</media:title>
		</media:content>
	</item>
		<item>
		<title>ReaderQuery : How to extract the last activity done with the client ?</title>
		<link>https://theaccessbuddy.wordpress.com/2014/02/02/readerquery-how-to-extract-the-last-activity-done-with-the-client/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/02/02/readerquery-how-to-extract-the-last-activity-done-with-the-client/#respond</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Sun, 02 Feb 2014 10:13:44 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Criteria]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Inner Query]]></category>
		<category><![CDATA[MS Access Filter]]></category>
		<category><![CDATA[MS Access Query]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Outer Query]]></category>
		<category><![CDATA[Sub-Query]]></category>
		<category><![CDATA[Top or Bottom Records]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=345</guid>

					<description><![CDATA[In this post, you&#8217;ll learn to solve a specific query raised by one of our reader. The query is as follows: Lets see how to solve this.. Solution As per the query raised, let&#8217;s try to create the two tables &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/02/02/readerquery-how-to-extract-the-last-activity-done-with-the-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>In this post, you&#8217;ll learn to solve a specific query raised by one of our reader. The query is as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ReaderQuery : How to extract the last activity done with the client ?" border="0" alt="ReaderQuery : How to extract the last activity done with the client ?" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image41.png?w=480&#038;h=427" width="480" height="427"></p>
<p>Lets see how to solve this..</p>
<p><span id="more-345"></span></p>
<h1>Solution</h1>
<p align="justify">As per the query raised, let&#8217;s try to create the two tables – Tbl_Client and Tbl_Activity. The dummy tables are as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ReaderQuery : How to extract the last activity done with the client ?" border="0" alt="ReaderQuery : How to extract the last activity done with the client ?" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml1216df4.png?w=763&#038;h=446" width="763" height="446"></p>
<p align="justify">As you can see, the first table &#8216;TblClient&#8217; contains the following fields:</p>
<ul>
<li>
<div align="justify">ID (Primary Key – Uniquely Identifies each customer) </div>
<li>
<div align="justify">Full Name &#8211; This&nbsp; holds the full name of the customer.</div>
</li>
</ul>
<p align="justify">Whereas the second table &#8216;TBLActivity&#8217; contains the following fields:</p>
<ul>
<li>
<div align="justify">Activity_ID (Primary Key – Uniquely identifies each transaction with each customer in the table) </div>
<li>
<div align="justify">ID – (Foreign key – This field in the table &#8216;TBLActivity&#8217;&nbsp; uniquely identifies the row of another table &#8216;TblClient&#8217;. It establishes an one-to-many link between the two tables) </div>
<li>
<div align="justify">ActivityDate – This field list the date on which a particular activity was done with the client. </div>
<li>
<div align="justify">ActivityType – This fields describes the type of activity done with the client.</div>
</li>
</ul>
<p align="justify">Now, you want to create a query such that the query should return the last activity done with the clients. Likewise, this needs to be done for all the clients.</p>
<p align="justify">This is very similar to the example discussed in the previous post : <a href="https://theaccessbuddy.wordpress.com/2014/02/01/how-to-select-top-n-or-bottom-n-records-from-a-dataset/" target="_blank">Select Top &#8216;n&#8217; Records across each Group</a></p>
<p align="justify">The query for this example can be constructed as follows:</p>
<ol>
<li>
<div align="justify">In the Outer query, you first select the field [FullName] from table TblClient, then select the fields [ActivityDate] and [ActivityType] from the other table TblActivity.<br />Since you want to find the final activity done with the client, you would be interested in knowing the final date on which you last dealt with that client and made an entry in the system. You would then find the activity corresponding to that final date. To do so, you should sort the field [ActivityDate] in Descending Order. </div>
<li>
<div align="justify">In the criteria section of the field [ActivityDate], specify another query – a Sub-query. This query would select the top 1 date for each of the customer. Since we are interested in final/ latest date, you would sort this query in DESCENDING order. You then enclose this query within the In() operator. </div>
</li>
</ol>
<p align="justify">The final query is as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ReaderQuery : How to extract the last activity done with the client ?" border="0" alt="ReaderQuery : How to extract the last activity done with the client ?" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image5.png?w=995&#038;h=516" width="995" height="516"></p>
<p>On running this query, you get the desired output as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ReaderQuery : How to extract the last activity done with the client ?" border="0" alt="ReaderQuery : How to extract the last activity done with the client ?" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image6.png?w=968&#038;h=189" width="968" height="189"></p>
<p align="justify">Thus, in this way, you can create a query to extract the last activity done with the client.</p>
<p align="justify">Having done this, please share with everyone if you have any alternate way of achieving the same result.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/02/02/readerquery-how-to-extract-the-last-activity-done-with-the-client/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">345</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image41.png" medium="image">
			<media:title type="html">ReaderQuery : How to extract the last activity done with the client ?</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml1216df4.png" medium="image">
			<media:title type="html">ReaderQuery : How to extract the last activity done with the client ?</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image5.png" medium="image">
			<media:title type="html">ReaderQuery : How to extract the last activity done with the client ?</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image6.png" medium="image">
			<media:title type="html">ReaderQuery : How to extract the last activity done with the client ?</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Select Top &#8216;n&#8217; or Bottom &#8216;n&#8217; records from a dataset?</title>
		<link>https://theaccessbuddy.wordpress.com/2014/02/01/how-to-select-top-n-or-bottom-n-records-from-a-dataset/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/02/01/how-to-select-top-n-or-bottom-n-records-from-a-dataset/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Sat, 01 Feb 2014 20:15:38 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Criteria]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Correlated Sub-Query]]></category>
		<category><![CDATA[Inner Query]]></category>
		<category><![CDATA[MS Access Filter]]></category>
		<category><![CDATA[MS Access Query]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<category><![CDATA[Outer Query]]></category>
		<category><![CDATA[Sub-Query]]></category>
		<category><![CDATA[Top or Bottom Records]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=339</guid>

					<description><![CDATA[In this post, you will learn how to create a query to extract Top &#8216;n&#8217; or Bottom &#8216;n&#8217; records from a particular dataset. There are&#160; instances when you&#8217;ll need to extract top or bottom &#8216;n&#8217; records within a particular group.&#160; &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/02/01/how-to-select-top-n-or-bottom-n-records-from-a-dataset/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">In this post, you will learn how to create a query to extract Top &#8216;n&#8217; or Bottom &#8216;n&#8217; records from a particular dataset. There are&nbsp; instances when you&#8217;ll need to extract top or bottom &#8216;n&#8217; records within a particular group.&nbsp; In order to do so, MS Access provides a nifty feature&nbsp; &#8216;Return&#8217; &#8211; <img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image.png?w=137&#038;h=26" width="137" height="26"> that is used to extract the required Top or Bottom values. This feature is available under the Query setup in the Design Tab of the ribbon.</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image1.png?w=379&#038;h=396" width="379" height="396">  </p>
<p>So, lets get started with the actual scenarios……</p>
<p><span id="more-339"></span></p>
<h1>Real Life Scenario</h1>
<blockquote>
<p align="justify">You have been assigned a new business unit as an inventory manager and you want to know the following:</p>
<ul>
<li>
<div align="justify">The <u>Top 5 products</u> that are below the target inventory level </div>
<li>
<div align="justify">Similarly, the <u>Bottom 5 products</u> that are below the target inventory level. </div>
<li>
<div align="justify">For all the categories present in your data, find Top 3 products <u>across each of the category</u>.</div>
</li>
</ul>
</blockquote>
<h1><u></u>Select Top &#8216;n&#8217; or Bottom &#8216;n&#8217; Products</h1>
<p align="justify">As an inventory manager, you are trying to understand the current level of your company&#8217; stock. As per your company&#8217;s inventory policy, you have assigned a target inventory level across each products. This is the minimum level of stock that each product needs to have at any point of time. If your inventory for a product falls below this level, then you need to place a purchase order with the respective vendor. Besides that, you also have access to the information on the current inventory levels across each products. </p>
<p align="justify">So, now you are interested in analysing the difference between the current inventory levels and the target level across each products i.e. you want to analyse the &#8216;quantity below target level&#8217; for each the products – </p>
<blockquote>
<p align="center"><strong>&#8216;Qty below target level&#8217; = Target level – Current level.</strong></p>
</blockquote>
<p align="justify">To begin with, you want to know the top 5 products that have the maximum difference between the target levels and their current levels i.e. the top 5 products with maximum &#8216;Qty below target level&#8217;&nbsp; </p>
<p align="justify">There is a very easy way to achieve what you have discussed above. </p>
<p align="justify">The Northwind database comes with a query &#8216;Inventory&#8217; on which you just have to create a simple SELECT query as shown in the screenshot below:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml132e2a6.png?w=784&#038;h=603" width="784" height="603"></p>
<p>On running this query, you get the required output:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image11.png?w=782&#038;h=367" width="782" height="367"></p>
<p>Now, let us see how the result changes when you change the sort order :</p>
<ul>
<li>You change the sort to Ascending:
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml16c1480.png?w=820&#038;h=338" width="820" height="338"> </li>
</ul>
<blockquote>
<p><strong>The above result is nothing but &#8216;Bottom 5&#8217; products.</strong>&nbsp;</p>
</blockquote>
<ul>
<li>You do not mention sort at all: </li>
</ul>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml18372d6.png?w=855&#038;h=260" width="855" height="260"></p>
<p align="justify">As can be seen from above, the query simply returns the top 5 records in whatever order they are present in the source table. </p>
<h1>Select Top &#8216;n&#8217; Records across each Group</h1>
<p align="justify">Now, instead of just knowing the Top &#8216;n&#8217; products or Bottom &#8216;n&#8217; products, you might want to analyse say Top 3 products <u>across each category</u>.</p>
<p align="justify">For example if you have 4 categories, then you will be expecting something like : </p>
<div align="center">
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" width="214" align="center">
<tbody>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><b><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category</font></font></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><b><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product</font></font></b></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal"><b><font face="Calibri"><font style="font-size:11pt;" color="#000000">Quantity</font></font></b></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category1</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product1</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product2</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">20</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product3</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">5</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category2</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product1</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">150</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product2</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">110</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product3</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">90</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Category3</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product1</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">790</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product2</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">100</font></font></p>
</td>
</tr>
<tr>
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="86">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="72">
<p style="line-height:normal;margin:0;" class="MsoNormal"><font face="Calibri"><font style="font-size:11pt;" color="#000000">Product3</font></font></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" valign="top" width="54">
<p style="line-height:normal;margin:0;" class="MsoNormal" align="center"><font face="Calibri"><font style="font-size:11pt;" color="#000000">10</font></font></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>Ideally speaking, you would want Access to list all the categories present in the data and for each category list the top 3 values.  </p>
<p>This can be achieved by:  </p>
<ol>
<li>
<div align="justify">Creating a Query that would select the Category Name. </div>
<li>
<div align="justify">Then Creating another Query that would return the top 3 values for each row of the query above. To do so, you’ll have to embed or nest the 02<sup>nd</sup> query in the 01<sup>st</sup> Query. This type of query is called as a <strong>&#8216;<u>Sub-Query</u>&#8216;</strong> where the first query is referred to as an <u>Outer Query</u> while the second one is referred to as an <u>Inner Query</u>. </div>
</li>
</ol>
<p align="justify">Normally, an inner query is executed first and the results of the inner query are then used as criteria for the outer query. But in this case, the inner query is expected to run for every new category in the outer query. In other words, the inner query will run repeatedly for every category that might be selected by the outer query. This type of sub-query is nothing but a <strong><u>&#8216;correlated sub-query&#8217;</u></strong>.  </p>
<p align="justify">The query is constructed as follows:&nbsp;&nbsp; </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image2.png?w=1036&#038;h=553" width="1036" height="553"></p>
<p align="justify">As you can see from the screenshot above, the inner query selects the top 3 values of the column [Qty Below Target Level] for every category in the outer query . It does so every time the category in the inner query is equal to the category in the outer query.</p>
<p align="justify">Below is the SQL view of the query in the query grid above:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image3.png?w=953&#038;h=193" width="953" height="193"></p>
<p align="justify">Note that both the first query as well as the second query is referring to the same table ‘Inventory1’. However, in the outer query the table will be used to select the category name along with the quantity field whereas in the inner query the table will be used to select top 3 values for each category. As you can see, in both the queries the tables are going to have different role. Hence, you cannot use the same table name in both the queries. However, you can create an alias of the original table. Creating an alias in the second query allows you to refer the same table but with different name while the first query is still referring to the same table with the original name. </p>
<p align="justify">Let&#8217;s say for a category = &#8216;Beverages&#8217; in the outer query, the inner category returns 3 top values of the column [Qty Below Target Level] for the same category. Let&#8217;s say those 3 values are 750, 690, 120. </p>
<p align="justify">As you might have noticed the inner query is enclosed within the <strong><a href="https://theaccessbuddy.wordpress.com/2013/10/12/4-additional-operators-in-ms-access-that-you-can-use-operator-types-5-of-5/" target="_blank">In() operator</a></strong>. So, inner query on returning the 3 values would look like : </p>
<blockquote>
<p align="center"><font size="3"><strong>In (750,690,120)</strong></font></p>
</blockquote>
<p>This now becomes the criteria for the outer query under the column [Qty Below Target Level]. On evaluating the outer query, you get the top 3 values across the category &#8216;Beverages&#8217;.</p>
<p align="justify">Similarly, it repeatedly runs the inner and outer query for each of the categories.&nbsp; On running the above query, you get the desired output as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image4.png?w=906&#038;h=600" width="906" height="600"></p>
<p>In this way, you can select Top or Bottom &#8216;n&#8217; records across each Category.</p>
<h1>Other Points to Remember</h1>
<ol>
<li>
<div align="justify">You need to apply sort on the column that contains the top or bottom values. The sort could be in Ascending or Descending order depending on whether you need top or bottom values.</div>
<li>
<div align="justify">This feature could also be used during testing your queries. In real life,&nbsp; you&#8217;ll normally encounter huge datasets while analysing the data. These datasets will have thousands of rows and multiple columns. So, every time you create a query and try to run it, the resulting dataset will also be huge. So, the whole activity of running the query on such a huge dataset and returning a resulting dataset takes a lot of time. <br />Further, it is not as if you are going to write a query in one go. You&#8217;ll first write a part of a query, then run to validate the results of the query. Then again go back to add another criteria to the existing query or maybe add another calculated field, then again run this query to confirm whether or not you are getting the expected results. In order to do all these iterations, you&#8217;ll be running the query multiple times. Given the huge dataset, this activity is then going to consume a lot of time.&nbsp; However, using the feature discussed in this post can save you a lot of time. Once you are satisfied that the query is returning the expected result, you can then remove the Top clause.</div>
<li>
<div align="justify">There is an alternate way to enter the TOP &#8216;n&#8217; values. As can be seen from the screenshot below, the top 5 or 3 values could be entered in the property sheet under the General Tab. The property panel is activated by right clicking and clicking on &#8216;Properties&#8217; option. </div>
</li>
</ol>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" border="0" alt="Select Top 'n' or Bottom 'n' records from a dataset in MS Access" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml3c6cb0f.png?w=812&#038;h=624" width="812" height="624"></p>
<p align="justify">&nbsp;</p>
<h1 align="justify">Homework</h1>
<p align="justify">You can further practise this feature by extracting TOP % or Bottom % of the records. Everything remains the same – you just need to enter the % values instead of integer values.</p>
<p align="justify">So, how about you create a query to get the expected result for the following scenario: </p>
<ul>
<li>
<div align="justify">Top products that accounted for 75% of total sales. </div>
<li>
<div align="justify">Bottom products that accounted for 20% of the total sales</div>
</li>
</ul>
<p align="justify">Once you are done, you can share your observations with all the readers on this blog. Good luck.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/02/01/how-to-select-top-n-or-bottom-n-records-from-a-dataset/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">339</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image1.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml132e2a6.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image11.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml16c1480.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml18372d6.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image2.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image3.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/image4.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/02/snaghtml3c6cb0f.png" medium="image">
			<media:title type="html">Select Top &#039;n&#039; or Bottom &#039;n&#039; records from a dataset in MS Access</media:title>
		</media:content>
	</item>
		<item>
		<title>DSUM() function &#8211;The Art of Writing a Criteria : 3</title>
		<link>https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/</link>
					<comments>https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Thu, 02 Jan 2014 13:09:01 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=317</guid>

					<description><![CDATA[In this post, you’ll learn to work with DSUM() function with date as a criteria. It is very similar to the way you create the text criteria with the only exception being the delimiters used. In case of dates, you’ll &#8230; <a href="https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">In this post, you’ll learn to work with DSUM() function with date as a criteria. It is very similar to the way you create the text criteria with the only exception being the delimiters used. In case of dates, you’ll use hash (#) as a delimiter instead of a single quote (&#8216; &#8216;) that you use in case of text values.</p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image.png?w=325&#038;h=428" width="325" height="428"></p>
<p align="justify">The date criteria enables you to extract data within a particular time period or before/after a certain date as explained in this post…</p>
<p><span id="more-317"></span></p>
<p align="justify">
<h1>Work Scenario</h1>
<blockquote>
<p>You are analysing the inventory data of your company and you want to know the following details:</p>
<ul>
<li>
<div>Scenario 1 : The total inventory sold on a particular date (say 03/22/2006) </div>
<li>
<div>Scenario 2 : The total inventory sold across different days. </div>
</li>
</ul>
<p>You want to solve the above two scenarios using DSUM() function. Now, that leaves you thinking.. </p>
</blockquote>
<h1>DSUM function with Date Criteria</h1>
<p align="justify">Since you are working on inventory, you’ll access the Inventory Transactions table from the Northwind database.</p>
<p align="justify">In this table, you would require the following fields:&nbsp;&nbsp; </p>
<ul>
<li>
<div align="justify">Transaction Date – This field indicates the date on which the inventory transaction took place.</div>
<li>
<div align="justify">Quantity – This field indicates the total quantity of inventory being handled.</div>
<li>
<div align="justify">Transaction Type – This field indicates whether the inventory was sold, purchased or whether it was on-hold.</div>
</li>
</ul>
<p align="justify">Before you start creating any query, it is always a good practice to go through the table and its fields that you’ll be analysing and have a look at the type of the data that they are holding.</p>
<p align="justify">In the above mentioned table “Inventory Transaction”, though the [Transaction Modified Date] appears to be of the format mm/dd/yyyy, it is actually of the format mm/dd/yyyy hh:mm:ss AM/PM. </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/snaghtmlc8be91.png?w=554&#038;h=224" width="554" height="224"></p>
<p align="justify">Now, since you want to know the total inventory sold on a particular date, the time component is irrelevant to your analysis. So, you will have to disregard the time&nbsp; by using the following functions:</p>
<ul>
<li>
<div align="justify">format(“[]”, “mm/dd/yyyy”). But the output will be a a string of the format “mm/dd/yyyy” and you need a date format. </div>
<li>
<div align="justify">Hence you’ll further use the cdate function over the format function:&nbsp; <br />cdate( format(“[]”, “mm/dd/yyyy”))</div>
</li>
</ul>
<p align="justify">So, lets create a new query, to get the desired result as explained above:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image1.png?w=640&#038;h=427" width="640" height="427"></p>
<p>On running this query, you get the following output:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/snaghtmlf5ce1c.png?w=754&#038;h=249" width="754" height="249"></p>
<p>Now that you have the dataset in the desired format, you can start working on the scenarios:</p>
<h1>Scenario 1</h1>
<p align="justify">In this scenario, you know outright that you need the result for one specific date only. </p>
<ol>
<li>
<div align="justify">So, from the from the given dataset, you might want to filter the inventory transactions of that particular date. (You might see the benefit of this step if you are dealing with thousands of records&nbsp; of inventory transactions across hundreds of different dates.)</div>
<li>
<div align="justify">Then you group all the transactions on the required date (03/22/2006 in this case) and apply a dsum() function to sum the field [Quantity] based on the criteria of date as well as transaction type (i.e. inventory that was sold).</div>
</li>
</ol>
<p>The criteria for DSUM() function will be written as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image16.png?w=232&#038;h=40" width="232" height="40"></p>
<p>The query looks like as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image11.png?w=767&#038;h=448" width="767" height="448"></p>
<p>And the output is : </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image12.png?w=402&#038;h=73" width="402" height="73"></p>
<p>Other possible conditions for dates are as follows:</p>
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" width="758">
<tbody>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:black 1pt solid;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><b><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Description</font></font></span></b></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:black 1pt solid;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><b><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Date Conditions</font></font></span></b></p>
</td>
</tr>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Before a particular date</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">([Mdate] &lt; #03/22/2006#)</font></font></span></p>
</td>
</tr>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">After a particular</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">([Mdate]&gt; #03/22/2006#)</font></font></span></p>
</td>
</tr>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">On or before a particular date</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">([Mdate]&lt;= #03/22/2006#)</font></font></span></p>
</td>
</tr>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">On or After a particular date</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">([Mdate]&gt;= #03/22/2006#)</font></font></span></p>
</td>
</tr>
<tr style="height:15pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="196" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Between two dates :</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="20" valign="top" width="562" nowrap>
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">&nbsp;</font></font></span></p>
</td>
</tr>
<tr style="height:30pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="40" valign="top" width="196" nowrap>
<p style="line-height:normal;text-indent:11pt;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Both Dates Included</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="40" valign="top" width="562">
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Inv: DSum(&#8220;[Quantity]&#8221;,&#8221;dsumdata&#8221;,&#8221;<b>[Mdate] between #04/03/2006# and #04/04/2006#</b> AND [Transaction Type]=2&#8243;) </font></font></span></p>
</td>
</tr>
<tr style="height:30pt;">
<td style="border-bottom:black 1pt solid;border-left:black 1pt solid;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="40" valign="top" width="196" nowrap>
<p style="line-height:normal;text-indent:11pt;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Both Dates Excluded</font></font></span></p>
</td>
<td style="border-bottom:black 1pt solid;border-left:medium none;border-top:medium none;border-right:black 1pt solid;padding:0 5.4pt;" height="40" valign="top" width="562">
<p style="line-height:normal;margin:0;" class="MsoNormal"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Inv: DSum(&#8220;[Quantity]&#8221;,&#8221;dsumdata&#8221;,&#8221;<b>[Mdate] &gt;#04/03/2006# and [Mdate] &lt; #04/04/2006#</b> AND [Transaction Type]=2&#8243;) </font></font></span></p>
</td>
</tr>
</tbody>
</table>
<h1>Scenario 2</h1>
<p align="justify">In order to find the total quantities across all the dates, you’ll provide a direct reference to the field [Mdate] containing the date values while constructing the DSUM() function. The criteria in the dsum() function will be written as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image19.png?w=331&#038;h=37" width="331" height="37"></p>
<p align="justify">You’ll construct the query exactly the same way you did in scenario 1 except that in this scenario you would be referencing to the field instead of specifying a direct value:</p>
<p align="justify">The query for scenario 2 would look like :</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image22.png?w=756&#038;h=456" width="756" height="456"></p>
<p>And on running this query, the output is :</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image26.png?w=406&#038;h=121" width="406" height="121"></p>
<p>In this way, you can get the desired result as required in scenario 2.</p>
<h1>Summary</h1>
<p align="justify">So, you&nbsp; have seen how a DSUM() function can be created and more importantly how a criteria can be constructed based on the following three data types:</p>
<ol>
<li>
<div align="justify">Text&nbsp; &#8211; <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function –The Art of Writing a Criteria : 1</a> </div>
<li>
<div align="justify">Number &#8211; <a href="https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/" target="_blank">DSUM() function –The Art of Writing a Criteria : 2</a></div>
<li>
<div align="justify">Date &#8211; DSUM() function –The Art of Writing a Criteria : 3</div>
</li>
</ol>
<p align="justify">Just to refresh your memory, the criteria for all the three data types can be constructed as follows:</p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 3" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 3" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image10.png?w=570&#038;h=139" width="570" height="139"></p>
<p align="justify">Also, in this post you have learnt the following two functions:</p>
<ol>
<li>
<div align="justify">Format () – This function converts values in specified string format</div>
<li>
<div align="justify">Cdate() – This function converts values into dates provided the value passed as an argument is a valid date expression. </div>
</li>
</ol>
<p align="justify">It is recommended that you read, practice and use these functions and share with us any interesting results.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">317</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/snaghtmlc8be91.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image1.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/snaghtmlf5ce1c.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image16.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image11.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image12.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image19.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image22.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image26.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2014/01/image10.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 3</media:title>
		</media:content>
	</item>
		<item>
		<title>DSUM() function &#8211;The Art of Writing a Criteria : 2</title>
		<link>https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/</link>
					<comments>https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Thu, 26 Dec 2013 16:19:18 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=302</guid>

					<description><![CDATA[In the previous post, you have learnt how DSUM() function works as well as how to specify a text criteria. As mentioned earlier, the criteria could be a text criteria or a number or a date. Depending on the data &#8230; <a href="https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">In the previous post, you have learnt how DSUM() function works as well as how to specify a text criteria. As mentioned earlier, the criteria could be a text criteria or a number or a date. Depending on the data type of the criteria, there is a slight change in how you construct the criteria part of the DSUM() function in terms of the delimiters to be used as well as the placement of the criteria value.</p>
<p align="justify">[Note: If you are new to DSUM() function, it is recommended that you read this post first : <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function – The Art of Writing a Criteria : 1</a>]</p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image6.png?w=335&#038;h=428" width="335" height="428"></p>
<p align="justify">In this post, you are going to learn more about specifying the number criteria. Let us see how…</p>
<p><span id="more-302"></span></p>
<p align="justify">
<h1>Work Scenario</h1>
<blockquote>
<p align="justify">You and your team want to know the total invoice value of all the orders placed. Its a pretty straight forward requirement but you want to use DSUM() function to achieve this.</p>
</blockquote>
<h1>DSUM function with Number Criteria </h1>
<p align="justify">In order to run to get a result as required in the work scenario, you’ll be using the table “Order details” and the following field: Order Id, Unit Price, Quantity.</p>
<p align="justify">As a recap, the formula for DSUM function is as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image31.png?w=640&#038;h=220" width="640" height="220"></p>
<p align="justify">Also, by now you might be knowing that the criteria can be specified in two ways:</p>
<ul>
<li>
<div align="left"><strong><u>Provide a direct value: </u></strong></div>
</li>
</ul>
<p align="justify">Lets say you want to find the total invoice value of an Order ID = 40. To do so, you’ll create the criteria by directly specifying the number as follows:</p>
<p align="left"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image9.png?w=185&#038;h=41" width="185" height="41"></p>
<p align="center"><strong><font size="3">“[Order ID]=40”</font></strong></p>
<p align="justify">Notice that when you want to specify a number criteria there are no delimiters required. You can simply specify the number directly after the = sign.</p>
<p align="justify">On constructing and running the query as explained above, you’ll get the following output:</p>
<p align="left"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image10.png?w=589&#038;h=447" width="589" height="447"></p>
<p align="left">And the output is:</p>
<p align="left"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image12.png?w=587&#038;h=105" width="587" height="105"></p>
<ul>
<li>
<div align="left"><strong><u>Provide a reference to a field</u></strong>&nbsp;</div>
</li>
</ul>
<p align="justify">You might want a similar output as shown above but you would need it for all the orders in the system. In such a scenario, you will have to construct the criteria by providing a reference to the field holding the order numbers. It will be constructed as follows:</p>
<p align="center"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image13.png?w=240&#038;h=47" width="240" height="47"><font size="3"><strong></strong></font></p>
<p align="center"><font size="3"><strong>“[Order ID]=”&amp;[Order ID]</strong></font></p>
<p>Note that the Order ID is the field that is holding value of data type – number.<br />The query would look like as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image15.png?w=621&#038;h=580" width="621" height="580"></p>
<p>On running this query, you’ll get the following result:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 2" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 2" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image16.png?w=380&#038;h=450" width="380" height="450"></p>
<h1>Summary</h1>
<p>In this post, you have seen how to create a DSUM function when the criteria that you are passing is of a number data type.</p>
<p>In the next post, you’ll learn to pass a criteria of data type – Date</p>
<ul>
<li><a href="https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/" target="_blank">DSUM() function –The Art of Writing a Criteria : 3</a>
<li><a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/" target="_blank">DSUM() function –The Art of Writing a Criteria : 1</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">302</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image6.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image31.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image9.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image10.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image12.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image13.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image15.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image16.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 2</media:title>
		</media:content>
	</item>
		<item>
		<title>DSUM() function &#8211;The Art of Writing a Criteria : 1</title>
		<link>https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/</link>
					<comments>https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/#comments</comments>
		
		<dc:creator><![CDATA[theaccessbuddy]]></dc:creator>
		<pubDate>Wed, 25 Dec 2013 17:03:26 +0000</pubDate>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[MS Access Query Basics]]></category>
		<guid isPermaLink="false">http://theaccessbuddy.wordpress.com/?p=290</guid>

					<description><![CDATA[As you learn more in MS Access, you will find that DSUM() function or for that matter any other domain aggregate functions such as DAvg(), DCount() etc. have interesting applications in data analysis. Now, these functions are very easy to &#8230; <a href="https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p align="justify">As you learn more in MS Access, you will find that DSUM() function or for that matter any other domain aggregate functions such as DAvg(), DCount() etc. have interesting applications in data analysis. Now, these functions are very easy to understand in terms of what they do but the only confusing part is the criteria part of the function. I have seen many people including myself getting a bit uncomfortable and making silly mistakes while constructing the criteria in this function.</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria : 1" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria : 1" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image4.png?w=328&#038;h=428" width="328" height="428"></p>
<p>In this post, you will learn what exactly does DSUM() function do and more importantly how to construct the criteria properly. So, lets begin……</p>
<p><span id="more-290"></span></p>
<h1>What is DSUM() and what does it do?</h1>
<p align="justify">DSUM() function as the name suggests is a function which helps you to sum the field (i.e. a column) specified in a particular table based on a certain criteria, if required. </p>
<p>The function is as follows :</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image1.png?w=640&#038;h=220" width="640" height="220"></p>
<p align="justify">As can be seen from above, there are two ways in which you can write a DSUM() function:</p>
<ol>
<li>
<div align="justify">Construct a DSUM() function with no Criteria</div>
<li>
<div align="justify">Construct a DSUM() function with a Criteria</div>
</li>
</ol>
<p align="justify">Lets look at each of the two ways of working with DSUM() function.</p>
<h1 align="justify">DSUM() with No Criteria</h1>
<p align="justify">In order to understand how a DSUM() function behaves when no criteria is specified, let us have a quick look at the following example :</p>
<p align="justify">Lets say, you want to sum the [Quantity] field in the table ‘Order details’ to see the total units ordered.</p>
<p align="justify"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image41.png?w=640&#038;h=400" width="640" height="400"></p>
<p>On running this query, you’ll get the following result:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image2.png?w=640&#038;h=277" width="640" height="277"></p>
<h1>DSUM() With Criteria</h1>
<p>In order to understand how the DSUM() function behaves when a criteria is specified, let us first analyse the criteria part of the DSUM() function. </p>
<p align="left"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image111.png?w=285&#038;h=89" width="285" height="89"></p>
<p>In the above snapshot, in place of = sign, you can also use other comparison operators like &lt;,&gt;,&lt;= or &gt;=.</p>
<p>Further, there are three types of criteria that can come after these comparison operators. Those are :</p>
<ol>
<li>Text&nbsp;
<li>Number
<li>Date</li>
</ol>
<h4 align="justify"><font color="#333333">Remember </font>: The text/number/date can either be <u>specified directly</u> or it can be <u>specified by referencing it to a column</u> containing the required&nbsp; text/number/date&nbsp; values. This will get clearer as we go through more examples below.</h4>
<h5><u></u>&nbsp;</h5>
<h1>DSUM() with Text Criteria</h1>
<p>Let’s consider a scenario where you want to determine the total shipping fee paid across all the cities to which you have shipped your products. In order to do so, you’ll refer the table ‘Orders’ which holds all the related details of the shipped orders. The details you would need are:  </p>
<ul>
<li>Field to be summed : [Shipping Fee]
<li>Table : Orders
<li>Other fields required : [Ship City]; </li>
</ul>
<p>You are somewhat expecting a similar output as follows:  </p>
<div style="line-height:normal;" align="center">
<table style="border-bottom:medium none;border-left:medium none;border-collapse:collapse;border-top:medium none;border-right:medium none;" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height:12.4pt;">
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="16" valign="top" width="98">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">City</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:windowtext 1pt solid;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="16" valign="top" width="132">
<p style="margin:0;" class="MsoNoSpacing"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">Shipping fee Total</font></font></span></p>
</td>
</tr>
<tr style="height:13.1pt;">
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="17" valign="top" width="98">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">City 1</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="17" valign="top" width="132">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">450</font></font></span></p>
</td>
</tr>
<tr style="height:12.4pt;">
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="16" valign="top" width="98">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">City 2</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="16" valign="top" width="132">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">555</font></font></span></p>
</td>
</tr>
<tr style="height:13.85pt;">
<td style="border-bottom:windowtext 1pt solid;border-left:windowtext 1pt solid;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="18" valign="top" width="98">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">City 3</font></font></span></p>
</td>
<td style="border-bottom:windowtext 1pt solid;border-left:medium none;border-top:medium none;border-right:windowtext 1pt solid;padding:0 5.4pt;" height="18" valign="top" width="132">
<p style="margin:0;" class="MsoNoSpacing" align="center"><span><font face="Calibri"><font style="font-size:11pt;" color="#000000">687</font></font></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>The query will be constructed as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image11.png?w=711&#038;h=419" width="711" height="419">  </p>
<p>As can be seen from the screenshot above:  </p>
<ol>
<li>
<div align="justify">You drag the field [Ship City] in the query grid. </div>
<li>
<div align="justify">Then, to begin with, just specify the DSUM() function without the criteria. On running this query, you’ll get the following. (Don’t forget to click the Totals button)<br /><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image5.png?w=245&#038;h=320" width="245" height="320"></strong></p>
<p>The total sum of the entire field [Shipping Fee] will come across each of the cities. <strong>BUT, this is not what you want. You want the total shipping fee paid across EACH city</strong>. </div>
<li>
<div align="justify">So now, you introduce a criteria in the DSUM() function <u>by referencing directly to the field</u> [Shipping City]. By referencing directly to the field, you are telling DSUM that for say a city A sum up the shipping fee corresponding to that city A only. Similarly, do the same for all the other cities present in the data. (Note the field [Shipping city] that you are referencing to contains Text values. The way you construct the criteria depends on the type of the data held in the criteria field)<s></s></div>
</li>
</ol>
<p align="center">The criteria argument is written as follows:<img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image8.png?w=276&#038;h=50" width="276" height="50"><br />(<i>text highlighted in red is the part where you will specify the criteria</i>)</p>
<p align="left">This means that the entire criteria argument will be passed as string to the MS Access data engine. Because criteria value is going to be of <u><strong>text data type</strong></u>, it will be included within single quotes‘’ as follows: </p>
<p align="center"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image112.png?w=293&#038;h=47" width="293" height="47">  </p>
<h4>Now, pay attention now – Here comes the <u>puzzling part</u>. </h4>
<p>Before you understand how to construct a criteria while referencing directly to a field, let us see how we construct it when we directly provide a text value.  </p>
<ol>
<li>
<div align="left"><b><u>Provide a direct value</u></b> :<br />If the criteriavalue that you are going to specify is a direct text like CityA, then you would directly specify that text within the single quotes as:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “Cfield =‘CityA’”<br />It would mean that DSUM would perform addition of the field shipping fee for the city ‘CityA’ <u>only</u>. In our example if we specify the city ‘Miami’, then we would get the same total across all cities as follows:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image14.png?w=611&#038;h=95" width="611" height="95"><br /><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image18.png?w=392&#038;h=319" width="392" height="319"></div>
<li>
<div align="justify"><b><u>Provide a reference to a field </u></b>:<br />We want DSUM() to calculate and display the sum corresponding to respective cities. So,we would reference directly to the field as discussed at the beginning of point 3 before.</div>
</li>
</ol>
<p>The criteriavalue itself is going to be a text, hence we would require a string within a string. In other words, the criteria string “Cfield =criteriavalue”will further include another string. That another string would be concatenated as <br />“&amp;[Ship City]&amp;”  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image113.png?w=326&#038;h=45" width="326" height="45">  </p>
<p>So, you&#8217;’ll create the query as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image411.png?w=640&#038;h=298" width="640" height="298">  </p>
<p>On running the above query, the result is as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image7.png?w=458&#038;h=386" width="458" height="386">  </p>
<h4 align="justify">Note: Different data types will require different delimiters. Delimiters tell Access that the value that it is going to encounter next is a text value or a date value or a numerical value. So, for text value the delimiter is quotes, for date value the delimiter is # whereas for numerical value there is no delimiter required. </h4>
<p>&nbsp;&nbsp; </p>
<h1>Multiple Criteria</h1>
<p>You might have noticed that in the query constructed above, there was only one criteria – City :  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image1111.png?w=782&#038;h=231" width="782" height="231">&nbsp; </p>
<p>The multiple criteria can be constructed as follows:  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image171.png?w=779&#038;h=174" width="779" height="174">  </p>
<p>On creating this query in the query grid and after running it, you’ll get the following output :  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image28.png?w=1107&#038;h=113" width="1107" height="113">  </p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image34.png?w=640&#038;h=397" width="640" height="397">  </p>
<h1>Summary</h1>
<p align="justify">So, in this way as explained above, you can create a DSUM function by specifying the criteria as per your need.</p>
<p align="justify">A summary of different criteria types is as follows:</p>
<p><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSUM() function &ndash;The Art of Writing a Criteria" border="0" alt="DSUM() function &ndash;The Art of Writing a Criteria" src="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image3.png?w=570&#038;h=139" width="570" height="139"></p>
<p align="justify">I guess you peruse and practice this concept before you move on to the other criterias (like number and date). Please go through this post carefully, try out different examples and share some interesting results/comments with everyone here.</p>
<h1>Next Steps : DSUM() with Other Criteria</h1>
<p>In the next post, you’ll learn to create a DSUM() with other criterias such as number and text.  </p>
<ul>
<li><a href="https://theaccessbuddy.wordpress.com/2013/12/26/dsum-function-the-art-of-writing-a-criteria-2/" target="_blank">DSUM() function –The Art of Writing a Criteria : 2</a>
<li><a href="https://theaccessbuddy.wordpress.com/2014/01/02/dsum-function-the-art-of-writing-a-criteria-3/" target="_blank">DSUM() function –The Art of Writing a Criteria : 3</a> </li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://theaccessbuddy.wordpress.com/2013/12/25/dsum-function-the-art-of-writing-a-criteria/feed/</wfw:commentRss>
			<slash:comments>25</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">290</post-id>
		<media:content url="https://0.gravatar.com/avatar/670a4c27d50c787439e3b76fcc2400d77f80307a70f6934c82d2ef39b16323b0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">theaccessbuddy</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image4.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria : 1</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image1.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image41.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image2.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image111.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image11.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image5.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image8.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image112.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image14.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image18.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image113.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image411.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image7.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image1111.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image171.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image28.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image34.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>

		<media:content url="https://theaccessbuddy.wordpress.com/wp-content/uploads/2013/12/image3.png" medium="image">
			<media:title type="html">DSUM() function &#8211;The Art of Writing a Criteria</media:title>
		</media:content>
	</item>
	</channel>
</rss>
