10 Replies Latest reply on Jun 3, 2016 3:43 PM by Ben Young

# Grouping Measures into sets

Hi I am trying to group a blended and calculated measure 'Age' into different groups, but I cannot figure out how to do so.

When I say 'groups' the end result should look like 0-7, 8-14. 14-30, 30-90, and 90+

I tried creating a new calculated field with this code below, but have not been able to have success without making the worksheet overly complicated:

If [Customer Age] <= 1

Then "day 1"

ELSEIF [Customer Age] >1 AND [Customer Age] <= 7

THEN "> 1 day, < 1 Week"

ELSEIF [Customer Age] >7 AND [Customer Age] <= 31

THEN "> 1 Week, < 1 Month"

ELSEIF [Customer Age] >31 AND [Customer Age] <=90

THEN "> 1 Month, < 90 Days"

ELSE "> 90 Days"

END

This is a sample of my data

The age number is calculated from

AVG([sqlDB)].[User Age]) - AVG([difference])

Determines age of user when the record was created

([sqlDB)].[User Age]) is calculated from

TODAY() - [Create Date]

-determines the current age of user

Difference is calculated from

( TODAY() - [Created Time] )

Need to get subtract the gap between today

[Create Date] = date the user was created

[Created Time] = date the record that is being analyze was created

How can I group these into sets to analyze in buckets? Much appreciated

• ###### 1. Re: Grouping Measures into sets

Hi Michael,

Assuming your calculation works (looks like it should; it's just hard to tell without a sample workbook) the fix should be pretty straightforward. If you convert the Measure to a Dimension, you can then right-click on the new Dimension and either create a Group or a Set, or just leave it as is. You can convert the Measure by right-clicking and choosing Convert to Dimension, or simply by dragging and dropping the Measure up to the Dimension pane.

If this doesn't work for you, would you please use this link Attaching a Packaged Workbook to attach a workbook? That way it's much easier to help out.

Hope this helps.

--Ben

• ###### 2. Re: Grouping Measures into sets

That's what I tried doing and it won't let me unfortunately. figured it would though

• ###### 3. Re: Grouping Measures into sets

Also Ben all of the data is in an SQL DB, I'm not sure I could get that over to you without sharing my entire DB

• ###### 4. Re: Grouping Measures into sets

If you go under the File menu, then click Export packaged workbook, you can create a packaged workbook. This has your views, as well as a copy of all the data it uses. As long as you're not sharing any confidential data, it is a great way to let others work on the Tableau file. If it is confidential, we can work on other options.

• ###### 5. Re: Grouping Measures into sets

Here,

I took a sample of the data and anonymized the personal/confidential details

Let me know if I need to be more specific

• ###### 6. Re: Grouping Measures into sets

First quick answer: blending data is tricky. For a blended dataset to work, you have to have detail from the secondary dataset on the view. If not, the blended data aggregates. So, in the views you sent me, the average is aggregating, so the average of the overall ticket ages is over 90.

If you add a field from the second dataset in (I added email since I assumed that would be unique), it does create the groups you're going for. However, because of the data on the view, it's showing a mark for each value, not summing them up. I'm working on fixing that one.

--Ben

• ###### 7. Re: Grouping Measures into sets

Sorry, this is as far as I'm getting. I've attached the workbook with my progress. I have more time tomorrow, I might be able to look into it then.

--Ben

• ###### 8. Re: Grouping Measures into sets

Thanks I really appreciate your help! It's not loading now, but I understand you'll be looking into it more

• ###### 9. Re: Grouping Measures into sets

Hi Ben, any ideas on this?

• ###### 10. Re: Grouping Measures into sets

Sorry Michael, I've been slammed this entire week. Hopefully this will bump it up so others can help out.

--Ben