joberg
joberg

Reputation: 11

Tableau: Segmenting and filtering

Hey fellow Tableau Ninjas,

I’m working on a Project right now, where I try to segment data within Tableau. I’ve seen a decrease in members within the last 3 years. I’d like to segment further into Two sets

1) Members that stay

2) Members that leave

I’ve managed to change the null value to zero(0) for The Members that leave. Is there a way to filter out the zeros? That would give me two segments; the people that still exercise and the people we lost.

Right now I'm working on the condition

COUNT([Number of Records]) < 1 but if I chose zero, it doesn't work.

I got Three years of data with several dimensions such as member ID, Age ect, date excercise

Most grateful for anykind of help, Jo

Upvotes: 1

Views: 1670

Answers (2)

Alex Blakemore
Alex Blakemore

Reputation: 11921

This is a good use case for dynamically computed sets.

For purposes of explanation, I'll show you how to make a set of all customers who have exercised at least 10 times, but you should be able to use the same procedure to define other sets. Here are the steps.

  1. Select the customer ID field in the data pane and then use the right mouse button to choose the Create Set command.
  2. Name the set Frequent Exercisers (or whatever name makes sense to you)
  3. Choose "Use all" on the general tab of the Create Set dialog
  4. Switch to the condition tab
  5. Select the "By field" option and enter Count([Number of Records]) > 10 (Alternatively, you can select the "by formula" option and enter a formula by hand that evaluates to true if and only if the customer Id is a member of the set)

You could define other sets, such as the set Recent Exercisers of customers that have exercised within the last 90 days, with a formula like max(Date) > dated(day, today(), -30)

Once you define some sets, you can:

  • use them as filters or as dimensions on the viz.
  • create new sets by combining two sets using intersection, union, difference etc.
  • test set membership in a calculated field just by referencing the set name.

You can also use the top tab to restrict set membership to the N largest or smallest items according to the metric of your choice. You can also use a parameter instead of a hard coded value in your formula that defines the set to allow people to interactively change the number of visits required to be classified as a frequent exerciser, or number of days in the past to be considered a recent exerciser in this example.

Upvotes: 1

Hannumk
Hannumk

Reputation: 11

I would look at doing it this way:

First Figure out the duration of the dates for the customer by using datedif to determine the lenth of time since first exercise date and the last.

Second Create a calculated field for TODAY()

THen determine the length of time since MAX date and today. Let'c call it Last_time and

Finally create a calculated field that sets them as active or not basedon the Last_time field. Something like this:

If [Last_time] < 365 (or 30 or however long they have to not have exercised to be inactive) THEN "ACTIVE" ELSE "INACTIVE" END

I would use a Gantt type chart as the viz. Each customer ID could be listed on the y axis. The Start and end date for exercising would be listed as top and bottom x axis. In the chart you can use a drop line to show where Today is. This will show if they come up to today or stop before it. You could also use a marks to separate anyone whose last exercise date was greater than say year from today from current year customers (or a month or a week) or you could use color.

Hope this helps.

Upvotes: 1

Related Questions