A client wants to see the average number of orders per customer per month, broken down by region. The client has created the following calculated field:
Orders per Customer: {FIXED [Customer ID]: COUNTD([Order ID])}
The client then creates a line chart that plots AVG(Orders per Customer) over MONTH(Order Date) by Region. The numbers shown by this chart are far higher
than the customer expects.
The client asks a consultant to rewrite the calculation so the result meets their expectation.
Which calculation should the consultant use?
The calculation {FIXED [Customer ID], [Region]: COUNTD([Order ID])} is the correct one to use for this scenario. This Level of Detail (LOD) expression will calculate the distinct count of orders for each customer within each region, which is then averaged per month. This approach ensures that the average number of orders per customer is accurately calculated for each region and then broken down by month, aligning with the client's expectations.
The initial calculation provided by the client likely overestimates the average number of orders per customer per month by region due to improper granularity control. The revised calculation must take into account both the customer and the region to correctly aggregate the data:
FIXED Level of Detail Expression: This calculation uses a FIXED expression to count distinct order IDs for each customer within each region. This ensures that the count of orders is correctly grouped by both customer ID and region, addressing potential duplication or misaggregation issues.
Accurate Aggregation: By specifying both [Customer ID] and [Region] in the FIXED expression, the calculation prevents the overcounting of orders that may appear if only customer ID was considered, especially when a customer could be ordering from multiple regions.
Level of Detail Expressions in Tableau: These expressions allow you to specify the level of granularity you need for your calculations, independent of the visualization's level of detail, thus offering precise control over data aggregation.
From the desktop, open the CC workbook. Use the US Population Estimates data source.
You need to shape the data in US Population Estimates by using Tableau Desktop. The data must be formatted as shown in the following table.
Open the Population worksheet. Enter the total number of records contained in the data set into the Total Records parameter.
From the File menu in Tableau Desktop, click Save.
To shape the data in the 'US Population Estimates' data source and enter the total number of records into the 'Total Records' parameter in Tableau Desktop, follow these steps:
Open the CC Workbook and Access the Worksheet:
From the desktop, double-click on the CC workbook to open it in Tableau Desktop.
Navigate to the Population worksheet by selecting its tab at the bottom of the window.
Format and Shape the Data:
Ensure the data types match those specified in the requirements: Sex, Origin, Race as strings; Year, Age, Population as whole numbers.
To verify or change the data type, click on the dropdown arrow next to each field name in the Data pane and select 'Change Data Type' if necessary.
Calculate Total Number of Records:
Create a new calculated field named 'Total Records'. To do this, right-click in the Data pane and select 'Create Calculated Field'.
Enter the formula COUNT([Record ID]) or SUM([Number of Records]) depending on how the data source identifies each row uniquely.
Drag this new calculated field onto the worksheet to display the total number of records.
Enter the Value into the Total Records Parameter:
Locate the 'Total Records' parameter in the Data pane. Right-click on the parameter and select 'Edit'.
Manually enter the number displayed from the calculated field into the parameter, ensuring accuracy to meet the data shaping requirement.
Save Your Changes:
From the File menu, click 'Save' to ensure all your changes are stored.
Tableau Desktop Guide: Provides detailed instructions on managing data types, creating calculated fields, and updating parameters.
Tableau Data Shaping Techniques: Outlines effective methods for manipulating and structuring data for analysis.
This process will ensure the data in the 'US Population Estimates' is accurately shaped according to the specified format and that the total number of records is correctly calculated and entered into the designated parameter. This thorough approach ensures data integrity and accuracy in reporting.
A client currently has a workbook with the table shown below.
Which method will produce the output for the Total Sales Value field for all the categories shown in the table?
To calculate the Total Sales Value for all categories as displayed in the table, an LOD expression is ideal. An LOD calculation in Tableau allows you to compute values at the data level that is different from the view level. In this case, since the Total Sales Value appears consistent across different sub-categories within each category, an LOD expression can be used to fix the Total Sales Value irrespective of the sub-category detail. Here's how to set it up:
Go to the Calculations area by right-clicking in the data pane and selecting 'Create Calculated Field'.
Enter a name for the calculation, such as 'Total Sales Value'.
Enter the LOD expression: { FIXED [Category] : SUM([Sales]) }. This calculation fixes the total sales to the category level, effectively summing sales for all sub-categories within each category, irrespective of how the data is broken down in the view.
Drag this new calculated field into your visualization alongside the existing measures.
This method ensures that the Total Sales Value reflects the total for each category across all its sub-categories, matching the uniform values shown across different rows for each category in your table.
Reference The explanation utilizes the concept of Level of Detail calculations in Tableau, which allows for advanced aggregations independent of the view level details. This concept is covered extensively in Tableau's official documentation and relevant training materials such as Tableau's online help resources.
An executive-level workbook leverages 37 of the 103 fields included in a data source. Performance for the workbook is noticeably slower than other workbooks
on the same Tableau Server.
What should the consultant do to improve performance of this workbook while following best practice?
To improve the performance of a Tableau workbook, it is best practice to streamline the data being used. This can be achieved by using filters to limit the data to only what is necessary for analysis, hiding fields that are not being used to reduce the complexity of the data model, and aggregating values to simplify the data and reduce the number of rows that need to be processed. These steps can help reduce the load on the server and improve the speed of the workbook.
A client has a database that stores widget inventory by day and it is updated on a nonstandard schedule as shown below.
They want a data visualization that shows widget inventory daily, however their business unit does not have the ability to modify the data warehouse
structure.
What should the client do to achieve the desired result?
For a client who needs a daily visualization of widget inventory but cannot modify the data warehouse structure, the best approach is to use Tableau Prep to add new rows. Tableau Prep can be used to manipulate the existing dataset by adding missing date entries and appropriately adjusting inventory counts based on available data. This allows the creation of a complete daily snapshot for visualization without needing changes to the underlying database structure.