Chapter 13. Enhancing Queries and Reports with Visualizations

Access isn't typically a tool you would think of when considering a dashboard style reporting tool. The reporting tools in Access, as slick as they are, don't readily lend themselves to data visualizations. That is to say, Access doesn't offer a whole lot in the way of dashboarding graphics. What's so great about visualization?

When you present your data through a visual interface, you can highlight key trends, point out comparisons, and focus in on outliers. Think of how much time it takes your end-users to process the table-driven reports you produce. Now imagine giving your users a visual interface that they can absorb at-a-glance. Adding visual components to your reporting arsenal not only makes you more effective at reporting data, but it helps your end-users become more effective at consuming data.

In this chapter, you explore some of the techniques that will help you go beyond tables filled with numbers. At the end of this chapter, you'll be turning your bland queries and reports into innovative visual interfaces.

Basic Visualization Techniques

Data visualizations don't always refer to fancy graphics. In fact, something as basic as specially formatted font or colored fields can be considered visualizations. In this section, you start with some simple techniques that will help spruce up your reporting.

Using Number Formatting Tricks to Enhance Reporting

As a general rule, you should always make your reporting easy to read and absorb. To that end, you should consider formatting the numbers in your reports to help your audience consume the needed information they need without confusion or hindrance. Why? Because it's never fun to count the zeros in a large number, especially when you're staring at 10 pitch font.

Here are some general best practices when it comes to formatting numbers for reporting:

  • Always use commas to make numbers easier to read (for example, instead of 2345, show 2,345).

  • Only use decimal places if that level of precision is required. For instance, there is rarely benefit for showing the decimal places in a dollar amount such as $123.45. Likewise in percentages, use only the minimum number of decimals required to represent the data effectively. For example instead of 43.21 percent, you may be able to get away with 43 percent.

  • Only use the dollar symbol when you need to clarify that you are referring to monetary values. If you have a chart or table that contains all revenue values, and there is a label clearly stating this, you can save room and pixels by leaving out the dollar symbol.

  • Format very large numbers to thousands or millions place. For instance, instead of displaying 16,906,714, you can format the number to read 16.9 M.

You can easily format numbers in Access by adjusting the Format property of your value fields. To test this, go to the sample database you downloaded with this book, and open the Access Report called "Revenue By 2007 vs 2008."

As you can see in Figure 13-1, there are a ton of numbers here. Instead of inundating your users with unnecessary digits, you can truncate the dollar values to thousands.

Follow these steps to format the numbers:

  1. Switch to Design View by going up to the Ribbon and clicking View

    Using Number Formatting Tricks to Enhance Reporting
  2. Click the 2007 field to set focus on it.

  3. You will see a Design tab in the Ribbon. Go to the Design tab and click the Property Sheet button.

  4. This activates the Property Sheet pane. Here, click the Format tab and enter $#,##0," k" into the Format property (see Figure 13-2).

  5. Click the 2008 field and apply the same number formatting.

To make this report easier to read, dollar values can be shown in thousands.

Figure 13.1. To make this report easier to read, dollar values can be shown in thousands.

Enter your custom number formatting into the Format property.

Figure 13.2. Enter your custom number formatting into the Format property.

Let's take a moment to analyze the syntax you just used: ($#,##0," k").

  • The dollar symbol ($) obviously tells Access that this is a currency value.

  • The pound signs along with the first comma (#,##0) defines a basic structure for any number that uses this format. In this case, #,##0 tells Access that commas should be used in any number larger than 999.

  • The comma after the 0 tells Access to truncate the number to the thousands place.

  • The letter k wrapped in quotes ("k") adds a visual indicator that these numbers are in thousands.

Switch back to report view to see the result of your change. If all went well, your report should now look like one shown here in Figure 13-3.

You have successfully applied your custom number format.

Figure 13.3. You have successfully applied your custom number format.

This is just one example of a custom number format you can apply to reduce the clutter in your reports. You can employ literally hundreds of alternative formats. Table 13-1 lists just a few of the common format syntax and how they can affect your numbers.

Table 13.1. Common Custom Number Syntax

ORMAT SYNTAX

HOW 6,404,954 WOULD BE DISPLAYED

#,##0

6,404,954

#,##0,

6,405

#,##0," k"

6,405 k

#,##0,," M"

6 M

$#,##0,

$6,405

$#,##0," k"

$6,405 k

$#,##0,," M"

$6 M

Using Conditional Formatting in Access

Conditional Formatting is the term given to the functionality where Access dynamically changes the formatting of a value based on a set of conditions you define. Conditional formatting allows your audience to, at a glance, make split-second determinations on which values are "good" and which are "bad," all based on formatting.

Conditional formatting is one of those functionalities in Access that offer countless ways of achieving a result. In this section, you cover a few basic examples of how conditional formatting can visually enhance your Access reporting. If you've worked with conditional formatting in Excel, this will be familiar territory.

Apply Conditional Formatting to a Field Based on its Own Value

The simplest way to apply conditional formatting is to test whether a field's value meets a specific criterion. For your first encounter with conditional formatting in Access, take a moment to walk through an example.

  1. Go to the sample database you downloaded with this book, and open the Access Report called Revenue by Segments.

  2. Switch to Design View by going up to the Ribbon and clicking View

    Apply Conditional Formatting to a Field Based on its Own Value
  3. Click the SumofSales_Amount field; then find the Format tab on the Ribbon. There, click the Conditional Formatting button shown in Figure 13-4.

    Selecting the Conditional Formatting button.

    Figure 13.4. Selecting the Conditional Formatting button.

  4. The Conditional Formatting dialog box will open (see Figure 13-5). Click the New Rule button.

    Choose to start a new rule.

    Figure 13.5. Choose to start a new rule.

    The New Formatting Rule dialog box will activate. Take a look at Figure 13-6. Because you are applying a condition to the current field based on its own values, the only adjustments that have to be made are to the operator dropdown and the criteria field.

  5. As you can see in Figure 13-6, you are applying a formatting rule to any value less than 50000. Select less than from the operator dropdown, and then enter 50000 in the criteria input.

  6. While you are still on this dialog box, assign a format you want applied to any value meeting your criteria.

    Apply a new format for any value under 50,000.

    Figure 13.6. Apply a new format for any value under 50,000.

  7. Click the OK button to finalize your conditional formatting. Figure 13-7 illustrates what your report will look like when you switch back to Report View.

    You've successfully applied your first conditional formatting in Access.

    Figure 13.7. You've successfully applied your first conditional formatting in Access.

With your newly applied conditional formatting, you can easily pick out the entry under 50,000. Although this is a relatively benign example, conditional formatting can prove useful in guiding your end-users toward key metrics on your report.

Apply Conditional Formatting Based on another Control's Value

Often times, you may need to set conditional formatting on a particular field based the values of another field. In these cases, you'll have to configure your conditional formatting slightly differently.

  1. Open the Revenue By Segment report again in Design View.

  2. Click the SumofSales_Amount field, and then click Conditional Formatting on the Format tab in the Ribbon.

  3. Because you have already set up a conditional format, you now have the Edit Rule button illustrated in Figure 13-8. From here, you can choose to create a new rule, or to edit the existing rule. Click the Edit Rule button.

    The Edit Rule option allows you to edit an existing conditional formatting rule.

    Figure 13.8. The Edit Rule option allows you to edit an existing conditional formatting rule.

    At this point, you will be taken to the Edit Formatting Rule dialog box shown in Figure 13-9. In this example, you want to edit the rule to check the PcntSales field. If the PcntSales Field is less than 20 percent, you want to apply your conditional formatting.

  4. As you can see in Figure 13-9, the Expression Is qualifier is being used this time. Any time you are evaluating your criteria against another field, you will choose the "Expression is" qualifier. On the same dialog box, enter [Pcnt Sales] <.20. This expression tells Access to evaluate the PcntSales field. If the value in that field is less than 20 percent, then the SumofSales_Amount field will be formatted.

    Use an expression to point to the field you need to evaluate.

    Figure 13.9. Use an expression to point to the field you need to evaluate.

  5. Click the OK button to finalize your conditional formatting. If you're following along, your report should look similar to the one shown here in Figure 13-10.

    Your conditional formatting is now based on the values in the percent of Revenue field.

    Figure 13.10. Your conditional formatting is now based on the values in the percent of Revenue field.

Clearing Conditional Formatting

If you find that you no longer need to conditionally format a particular field, you can follow these steps to clear the conditional formatting rule.

  1. Open your report in Design View.

  2. Click the control from which you want the conditional formatting removed.

  3. Click Conditional Formatting on the Format tab in the Ribbon.

  4. In the Conditional Formatting dialog box, select the condition you want removed and then click the Delete Rule button.

  5. Click OK to confirm.

Advanced Visualization Techniques

Up until now, you've been working with the visualization tools that are native to Access. Now it's time to move off the reservation a bit.

In this section, you explore a few techniques that go beyond the built-in functionality of Access. As you go through the rest of this chapter, you'll discover how a little outside-the-box thinking can expand your reporting capabilities and improve your ability to communicate through dashboard-style visualizations.

Enhancing Queries and Reports with Data Bars

Figure 13-11 shows a query that contains what seems to be a bar chart. This type of data visualization is typically referred to as in-cell charting (charting directly in a table, providing a visualization of the data shown). The cool thing is that the in-cell charting achieved here is the result of a simple calculation and the STRING function.

The in-cell charting seen here is nothing more than a query trick using the STRING function.

Figure 13.11. The in-cell charting seen here is nothing more than a query trick using the STRING function.

Introducing the STRING Function

The STRING function repeats a given character a specified number of times. For example, if you were to type the expression =STRING(10, 's'), the returned value would be ssssssssss (the "s" character repeated 10 times). To see this in action, build the query you see in Figure 13-12.

Testing the STRING function in a query

Figure 13.12. Testing the STRING function in a query

When you run this query, as promised, you will see a series of ten S's. Now you can alter this query so that instead of using a letter, you would use a character that, when repeated, looks kind of like a chart.

For this, you can use the ChrW function. The ChrW function returns Unicode characters based on a character number. For instance, ChrW(9608) returns a block that, when repeated several times, looks like a bar chart. Here is how you would use it with the STRING function.

String(10, ChrW(9608)

Figure 13-13 demonstrates how this is used in a query.

Using ChrW(9608) with the STRING function in a query produces a series of block characters reminiscent of a bar chart.

Figure 13.13. Using ChrW(9608) with the STRING function in a query produces a series of block characters reminiscent of a bar chart.

Obviously, it doesn't make sense to hard-code the number of times to repeat the character. You would ideally point the STRING function to some sort of field or mathematical operation that gives you a number of times to repeat. Figure 13-14 illustrates an example where the Revenue field is used in a mathematical operation to arrive at an appropriate number of times to repeat the block character.

In situations where you have large values, you can divide the vales by 10, 100, 1000, etc. in order to calculate an appropriate repeat number.

Figure 13.14. In situations where you have large values, you can divide the vales by 10, 100, 1000, etc. in order to calculate an appropriate repeat number.

As you can see in Figure 13-15, you couldn't just use the raw Revenue field to feed the STRING function. There would be too many block characters, and the function would fail. So the RepeatNumber field is calculated to derive a repeat number that works.

The results of your test query

Figure 13.15. The results of your test query

Another way to limit the number of times a character is repeated is to calculate a maximum repeat number. You can do this by getting a bit fancy and using Access' DSUM function. To understand this, take a look at Figure 13-16.

The expression in the RepeatNumber column basically tells Access to take the value being referenced and divide it by the sum for the entire range. This returns a percent weighting, which is then multiplied by 100. Stand back and think about what this means. The maximum number of characters that can possibly be returned by this formula is 100, no matter how big the revenue figures are.

Use the DSUM Function to establish a ceiling on your repeat number.

Figure 13.16. Use the DSUM Function to establish a ceiling on your repeat number.

Note

You may be wondering why you would not just use the data bars conditional formatting feature, or for that matter, a chart? First, data bars are not backwards compatible. Meaning anyone who doesn't have Access 2010 won't be able to use them. Second, their gradient style may not conform to the overall look and feel of your dashboard. As for standard charts, they take up much more space than in-cell charting. Plus they add overhead to your file. In-cell charting gives you an easy to implement alternative that doesn't require a lot of real-estate or setup.

Extending Data Bars to Reports

Because these clever new data bars are expression driven, they can be used practically anywhere you can use an expression. In Figure 13-17, a new TextBox has been added to the Revenue by Segments report, and a STRING expression is used to create a data bar.

You can use your new data bar anywhere you can enter an expression.

Figure 13.17. You can use your new data bar anywhere you can enter an expression.

Figure 13-18, shows the data bars in Report view. Note that because these data bars are text based, they can be formatted just like any other text.

These data bars can also be formatted to be different colors and sizes.

Figure 13.18. These data bars can also be formatted to be different colors and sizes.

Sprucing up Queries and Reports with Symbols

With the release of Office 2007, Excel introduced new conditional formatting rules that allow you to show dashboard-esque icons to your cells. With these icons, you can represent performance using different shapes and colors. Unfortunately, no such functionality exists in your cache of Access 2010 tools.

A creative alternative is using the fancy characters and symbols you can get from the ChrW function. You were introduced to the ChrW function earlier in this chapter ("Enhancing Queries and Reports with Data Bars"). If you'll remember, the ChrW function returns Unicode characters based on a character number. For instance, ChrW(9608) returns a block character. These characters allow you to mimic Excel's icon sets, using symbols to provide users a visual representation of performance.

Before walking through an example, look at Table 13-2. Here, you will see some of the Unicode characters often seen on dashboard reports. Again, the idea is to pass the character number through the ChrW function. For example, ChrW(9650) would return an up arrow symbol.

To understand the benefit of using symbols in reporting, go to the sample database you downloaded with this book, and open the Access Report called Revenue By 2007 vs 2008.

As you can see in Figure 13-19, this report compares revenues in 2008 to those in 2007. Obviously, the goal of this report is to convey the movement up or down in revenue from one year to another.

Table 13.2. Unicode Character Codes and Their Associated Symbols

CHARACTER CODE

ASSOCIATED SYMBOL

8592

Unicode Character Codes and Their Associated Symbols

8593

Unicode Character Codes and Their Associated Symbols

8594

Unicode Character Codes and Their Associated Symbols

8595

Unicode Character Codes and Their Associated Symbols

8598

Unicode Character Codes and Their Associated Symbols

8599

Unicode Character Codes and Their Associated Symbols

8600

Unicode Character Codes and Their Associated Symbols

8601

Unicode Character Codes and Their Associated Symbols

8678

Unicode Character Codes and Their Associated Symbols

8679

Unicode Character Codes and Their Associated Symbols

8680

Unicode Character Codes and Their Associated Symbols

8681

Unicode Character Codes and Their Associated Symbols

9607

Unicode Character Codes and Their Associated Symbols

9608

Unicode Character Codes and Their Associated Symbols

9650

Unicode Character Codes and Their Associated Symbols

9658

Unicode Character Codes and Their Associated Symbols

9660

Unicode Character Codes and Their Associated Symbols

9668

Unicode Character Codes and Their Associated Symbols

9670

Unicode Character Codes and Their Associated Symbols

9671

Unicode Character Codes and Their Associated Symbols

9679

Unicode Character Codes and Their Associated Symbols

9680

Unicode Character Codes and Their Associated Symbols

9681

Unicode Character Codes and Their Associated Symbols

9682

Unicode Character Codes and Their Associated Symbols

9683

Unicode Character Codes and Their Associated Symbols

9684

Unicode Character Codes and Their Associated Symbols

9685

Unicode Character Codes and Their Associated Symbols

9698

Unicode Character Codes and Their Associated Symbols

9699

Unicode Character Codes and Their Associated Symbols

9700

Unicode Character Codes and Their Associated Symbols

9701

Unicode Character Codes and Their Associated Symbols

10003

Unicode Character Codes and Their Associated Symbols

10007

Unicode Character Codes and Their Associated Symbols

10025

Unicode Character Codes and Their Associated Symbols
Open the Revenue By 2007 vs 2008 report.

Figure 13.19. Open the Revenue By 2007 vs 2008 report.

In order to help absorb this data faster, let's add a set of up and down arrows representing the increase or decrease in revenue from 2007 to 2008.

  1. Switch to Design View by going up to the Ribbon and clicking View

    Open the Revenue By 2007 vs 2008 report.
  2. Add a new TextBox next to the 2008 field (Figure 13-20).

    Add a TextBox.

    Figure 13.20. Add a TextBox.

  3. In the newly added TextBox, enter the following IIf statement: =IIf([2008]>[2007],ChrW(9650),ChrW(9660)). This checks if the 2008 revenue is greater than 2007. If so, then an up arrow is return via the ChrW function. If not, a down arrow is returned. Your screen should look similar to that shown in Figure 13-21.

    Build an IIf statement that evaluates revenue and returns either an up arrow or down arrow.

    Figure 13.21. Build an IIf statement that evaluates revenue and returns either an up arrow or down arrow.

  4. Since you're knee-deep in creating a visualization, you might as well add some conditional formatting. Click your newly created TextBox and select Conditional Formatting from the Format tab. This activates the Conditional Formatting Rules Manager dialog box.

  5. Click the New Rule button.

  6. Select the "Expression Is" qualifier, then enter [2008]>[2007] in the condition input (see Figure 13-22). This formats all arrows where the revenue from 2008 is greater than 2007 (up arrows). Needless to say, you want to select formatting that corresponds with good performance. Format the Font Color green.

    Create a conditional formatting for up arrows.

    Figure 13.22. Create a conditional formatting for up arrows.

  7. Press OK to confirm your changes and to return to the Conditional Formatting Rules Manager.

  8. Now you'll need to add conditional formatting to those records where 2007 is greater than 2008. Click the New Rule button.

  9. Select the "Expression Is" qualifier, then enter [2007]>[2008] in the condition as demonstrated in Figure 13-23. This formats all arrows where the revenue from 2007 is greater than 2008 (down arrows). For the down arrows, format the Font Color Red.

    Create a conditional formatting for down arrows.

    Figure 13.23. Create a conditional formatting for down arrows.

  10. Take some time to format your arrows; make them bigger, align them to the other fields, and so on. If all went well, your report should look similar to Figure 13-24.

With your new visualizations, you easily pick out the poor performers.

Figure 13.24. With your new visualizations, you easily pick out the poor performers.

Using Your Own Dashboard Graphics in Access

Figure 13-25 shows a dashboard report (gauges included) that contains data related to internet revenue. Believe it or not, this report was done in Access. If you open the sample database for this book, you will find a Report object called Dashboard Report.

Amazingly, this report was created in Access.

Figure 13.25. Amazingly, this report was created in Access.

Storing External Graphics in an Access Table

The starting point to this technique is obviously graphics. You'll need to decide which graphics to use. For illustrative purposes, Figure 13-26 shows a directory that has several bitmap files (each one containing a representation of a gauge). Note how the title of each file is a number. When creating graphics for dashboarding purposes, the idea is to name each file a number corresponding to a value from 1 to 100. So file 50 represents 50 percent, file 40 represents 40 percent, and so on.

Start with a set of bitmap files, each representing a value from 1 to 100.

Figure 13.26. Start with a set of bitmap files, each representing a value from 1 to 100.

Note

The sample database for this book already contains a table ('DashboardGraphics' ) which contains a series of images ideal for dashboarding. This section is an illustrative look at how you would go about building your own dashboard graphics table.

Once you have graphics, you'll need to store them someplace. This is where Access tables come in. Figure 13-27 demonstrates a basic structure for a table designed to hold graphics. As you can see, you need only three columns to start.

  • A number column that holds numbers 1–100

  • A percent column that holds .01–1

  • An OLEObject column that holds the Bitmap graphics

The basic table structure needed to store graphics for dashboarding purposes

Figure 13.27. The basic table structure needed to store graphics for dashboarding purposes

Tip

OLE (Object Linking and Embedding) is a Microsoft technology that allows an application to store data packages such as text files, sound files, or picture files. The OLE Object field type in Access uses this technology to embed and store external data files directly into an Access database. Embedding files using an OLE Object field ensures that the embedded files travel with the database when distributed or moved.

Once Access has a place to store your graphics, you'll need to get your graphics into the table. Several multiple methods are available to do this. The easiest manual way is to drag them into the OLEObject field. Simply drag each graphic into the record corresponding to its value. For example, the bitmap file titled 40 would go into the record where the ValueNum field is 40 and the ValuePcnt field is .40. Figure 13-28 demonstrates how you would drag graphic files into the OLE Object field.

The drag and drop method is the easiest way to get graphics into an OLE Object field.

Figure 13.28. The drag and drop method is the easiest way to get graphics into an OLE Object field.

When all is said and done, you would have a "graphics table" where each record represents a number value from 1 to 100. Each number and percent value corresponds to the appropriate bitmap file (see Figure 13-29).

A completed graphics table

Figure 13.29. A completed graphics table

Using the Graphics Table

Using a graphics table is as easy as linking it to any analysis using the ValueNum or ValuePcnt columns. Figure 13-30 demonstrates how you would use a query to tie your graphics table to another dataset. In this case, the Pcnt Internet Revenue field is joined to the ValuePcnt field I the graphics table. This results in the appropriate image being associated to each value in the Pcnt Internet Revenue field.

The OLEObject column (the column that holds the bitmaps) in this example is called "GaugesHiGood."

Figure 13.30. The OLEObject column (the column that holds the bitmaps) in this example is called "GaugesHiGood."

After the query is saved, you can use it as the source for various reports and forms. Figure 13-31 shows that you can build reporting views in Access forms as well as Access reports.

You can build your dashboards directly on forms.

Figure 13.31. You can build your dashboards directly on forms.

Using Multiple Sets of Graphics

Keep in mind that you can have more than one OLEObject field in your graphics table. This allows you to have all kinds of different visual representations of 1–100. If you open the DashboardGraphics table found in the sample database for this book, you will see multiple columns representing different graphics.

Figure 13-32 demonstrates how using multiple graphics fields is as easy as selecting the desired graphic in a query.

This query identifies the progress bar as the graphic used.

Figure 13.32. This query identifies the progress bar as the graphic used.

Running this query produces the report in Figure 13-33.

The progress bar report

Figure 13.33. The progress bar report

Summary

Adding data visualizations to your reporting allows you to highlight key trends, point out comparisons, and focus in on outliers. It not only makes you more effective at reporting data, but it helps your end-users become more effective at consuming data.

Using Access' conditional formatting functionality is an easy way to quickly add visualizations to your reports. Conditional formatting allows your audience to, at-a-glance, make split-second determinations on which values are "good" and which are "bad," all based on formatting.

Outside of rudimentary conditional formatting, Access doesn't offer a whole lot in the way of data visualization and dashboarding graphics. But with a bit of imagination, you can create your own visualizations. Two examples covered in this chapter are data bars using the STRING function and fancy symbols using the ChrW function. Alternatively, thanks to Access' ability to store OLE objects, you can store and use your own graphics in reporting.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.215.202