VizWiz

Launch, grow, and unlock your career in data
Showing posts with label nested. Show all posts

June 1, 2021

How to Calculate the Most Frequent Value of a Measure

No comments
In this tip, I show you how to use both a level of detail expression and a table calculation to compute the most frequent value in a measure. 

First, I show you how to return this as a histogram as well as a single number.

By the end of this tip you will be able to calculate the most frequent quantity ordered. This same process could be used, for example, to compute the most frequent discount. 

January 14, 2020

#TableauTipTuesday: The Basics of Nested Level of Expressions

No comments
Nested LODs are often a very confusing topic and are usually only needed when you need to aggregate an already aggregated value to a higher level of detail.

In this video, I walk you through the step-by-step method I use for understanding Nested LODs with two examples:

  1. Average Number of Unprofitable Order Per Customer for Each Segment
  2. Average Sales per Ship Mode and Category Across Region

August 30, 2017

Workout Wednesday: Average Latitude of Solar Eclipses by Century

No comments
You might think I'm taking the easy way out this week for Workout Wednesday, but I found building last week's Makeover Monday chart not as straightforward as I thought so I figured I'd share the fun with you.


Requirements:


  1. Must be one sheet (except the footer)
  2. Must match my y-axis scale and format
  3. Must match my reference lines
  4. Match the blue and orange for the northern and southern hemispheres
  5. Match the title and subtitle
  6. Be sure to include the footer
  7. X-axis represents the centuries
  8. Century 3000 AD is excluded
  9. Black line is the average latitude across the centuries
  10. For each century and hemisphere, each "bar" spans from the max to the min average latitude by month, century and hemisphere.
  11. The bar width represents the difference between the max and min.
  12. Match the nice rounded ends on the "bars"
  13. Match the tooltips

You can download the data in Excel format here or the TDE here.

Good luck! Remember to tweet a picture and link to your solution and tag @EmmaWhyte and @VizWizBI. 

May 9, 2017

Tableau Tip Tuesday: Using LOD Expressions to Color Lines By the Most Recent Value

2 comments
This week's tip came about when working through a question at the Data School during our client project last week. The question was essentially:

How can I color each line on a line chart by the most recent value?
This requires a three-pass LOD expression. The key is to realize that Tableau created an aggregate table for each LOD working from the inside out. So

  1. Tableau calculates the inside LOD first.
  2. Then the second LOD is calculated based on the results of the first LOD.
  3. Then the third LOD is calculated based on the results of the second LOD. 

Make sense? I hope so! If not, let me know. Enjoy!

May 2, 2017

Tableau Tip Tuesday: How to Highlight the Min & Max Across Months with a Nested LOD

5 comments
This week's tip is a nice use case for nested level of detail expressions and also a nice test for my "LODs in an English sentence" method. It started with this tweet from Charlie Hutcheson:


If you scroll through the comments, you'll see that Charlie was hoping to do this via LOD, but couldn't quite get it. My tip this week solves this problem.

Enjoy!

March 17, 2015

Tableau Tip Tuesday: Two Techniques for Nested Sorting

25 comments
Early on in my 2-day Tableau courses, I teach about sorting in Tableau. You would think that teaching about sorting would be a pretty boring topic, but it’s easy to get the students engaged when you talked about nested sorting. Another way to think about nested sorting is to consider it sorting by more than one dimension.

In this week’s tip, I review two techniques for accomplishing nested sorting:

  1. Using combined fields
  2. Using the rank function, which has the additional benefit of allowing top N filtering

Download the workbook used to create this video here.

July 18, 2012

Tableau Tip: Using a parameter for dynamic nested filtering

8 comments

Suppose you have two dimensions, Customer Segment and Product Sub-Category, and you are displaying sales for each in a bar chart like this:

image

You want to look at only the top X Product Sub-Categories within each Customer Segment based on Sales.  Naturally, you click on the Sort Descending button, but, uh oh, you get this:

image

What happened?  The bars are not sorted by Product Sub-Category within each Customer Segment.  They’re actually sorted by the total of the Product Sub-Category across the entire table.

image

What we really want is for the Product Sub-Categories to be sorted within each Customer Segment.  To do that, you need to create a set.

Step 1 – Choose the two fields you want to create the set with, then right-click and choose Create Set.

image

Step 2 – Give the set a name if you want, rearrange them to the proper order and click ok. 

image

NOTE: If the columns are not in the order you want, then simply drag them left and/or right. In our example, we want Customer Segment first because that is our first level dimension.

Step 3 – Drag your new set into the view by placing it between the Customer Segment and Product Sub-Category dimensions on the Rows shelf.

image

Step 4 – Clear the sort from the Product Sub-Category dimension, then right-click on the Set on the Rows shelf and choose Sort.  Set the sort order to descending by Sales.

image

Your chart is now sorted by Product Sub-Category within each Customer Segment.

image

Step 5 – Clean up the chart by right-clicking on your set in the Rows shelf and uncheck Show Header. 

That still leaves some extra grid lines.  To clean them up go to the menu and choose Format => Borders.  Move the slider on the Row Divider level one spot to the left.

image

You should now have a nice clean bar chart. 

But, I want to see only the top X Product Sub-Categories within each Customer Segment.  Let’s continue on.

Step 6 – Create a parameter to allow the user to choose between the top 1 and the top 10.

image

Step 7 – Create a “rank” field that will show you the rank of each Product Sub-Category within each Customer Segment.

image

Step 8 – Add the Rank measure to the Level of Detail shelf.

Step 9 – Edit the Rank field by right-clicking on the Rank field and choosing Edit Table Calculation.  Choose Advanced from the Computing using list.

image

In the Advanced window, move both fields into the Compute Using box and change the Order Along section to Sales descending.  Click OK.

image

Now updated the Rank table calculation to the following:

image

Basically what this is saying is that the Rank field should compute for each Product Sub-Category within a Customer Segment, then it should restart counting when it gets to the next Customer Segment.

Step 10 – Create a calculated field that uses the Top X parameter to filter the number of Product Sub-Categories that should be displayed within each Customer Segment.

image

This creates a true/false filter.

Step 11 – Add the Top X ? true/false calculated field to the Filter shelf and select True.

Step 12 – Show the Top X parameter control created in Step 6 and you’re done!

image

You can now use the Top X control to pick how many Product Sub-Categories you want to show within each Customer Segment.

Download the Tableau Workbook here.