Sheet swapping and dynamic dashboards

Sheet swapping, sometimes also called sheet selection, is a technique in which views are dynamically shown and hidden on a dashboard, often with the appearance of swapping one view for another. The dynamic hiding and showing of views on a dashboard has an even broader application. When combined with floating objects and layout containers, this technique allows you to create rich and dynamic dashboards.

The basic principles are simple:

  • A view Collapses on a dashboard when at least one field is on Rows or Columns and a combination of filters or hiding prevents any marks from being rendered
  • Titles and captions do not collapse but can be hidden so that the view collapses entirely

Let's consider a simple example with a view showing profit by Department and Category with a Department quick filter. The dashboard has been formatted (from the menu, select Format | Dashboard) with a gray shading to help us see the effect:

Observe how filtering out all departments results in the view collapsing. The title remains, but it could have been hidden.

In order to swap two different sheets, we simply take advantage of the collapsing behavior along with the properties of layout containers. We'll start by creating two different views filtered through a parameter and a calculated field. The parameter will allow us to determine which sheet is shown. Perform the following steps:

  1. Create an integer parameter named Show Sheet with a list of String values set to Bar Chart and Map:

  1. Since we want to filter based on the parameter selection and the parameters cannot be directly added to the Filters shelf, instead we'll create a calculated field named Show Sheet Filter to return the selected value of the parameter. The code is simply [Show Sheet], which is the parameter name, and returns the current value of the parameter.
  1. Create a new sheet named Bar Chart, similar to the Profit by Department and Category view shown in the earlier screenshot.
  2. Show the parameter control (right-click the parameter in the data window and select Show Parameter Control). Make sure the Bar Chart option is selected.
  3. Add the Show Sheet Filter field to the Filters shelf and check Bar Chart to keep that value.
  4. Create another sheet named Map that shows a filled map of states by profit:

  1. Show the parameter on this view and change the selection to Map. Remember that parameter selections are universal to the worksheet. If you were to switch back to the bar chart view, it should no longer be showing any data because of the filter.
  2. Add the Show Sheet Filter field to the Filters shelf and check Map as the value to keep.
  3. Create a new dashboard named Sheet Swap.
  4. Add a Horizontal layout container to the dashboard from the objects in the left window:

A Vertical layout container would work just as well in this case. The key is that a layout container will allow each view inside to expand to fill the container when the view is set to fit the entire view, or fit the width (for horizontal containers), or fit the height (for vertical containers). When one view collapses, the visible view will expand to fill the rest of the container.
  1. Add each sheet to the layout container in the dashboard. The parameter control should be added automatically since it was visible in each view.
  2. Using the drop-down menu on the Bar Chart view, ensure the view is set to fill the container (Fit | Entire View). You won't have to set the fill for the map because map visualizations automatically fill the container.
  3. Hide the title for each view (right-click the title and select Hide Title).

You now have a dashboard where changing the parameter results in one view or the other being shown. When Map is selected, the filter results in no data for the Bar Chart, so it collapses and the Map fills the container:

Alternately, when Bar Chart is selected, the Map collapses due to the filter and the Bar Chart fills the container:

The key to collapsing a view is to have a filter or set of filters that ensures no rows of data are shown. You do not have to use a parameter to control the filtering. You could use a regular filter or action filter to accomplish the same effect. This opens up all kinds of possibilities for dynamic behavior in dashboards.
..................Content has been hidden....................

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