3 Replies Latest reply on May 20, 2016 2:22 PM by Kevin Price

# Pie Charts and Calculated fields

Hello! I've done a lot of Googling and searching around the forum but can't seem to find what I am looking for even though I feel like it may be a common thing.

I have my pie charts almost where I want them but I want to group the colors together and display the percentage for the whole group instead of individually. (View Image) my AGG(RangeForMetrics) formula is below...

IF SUM([Number of Records]) >= 45 THEN "High"

ELSEIF SUM([Number of Records]) >= 25 THEN "Medium"

ELSE "Low"

END

The end result I'm looking for is a per quarter breakdown but keeping the detail of the weekly metrics.

Let me know if any other information is needed and thank you for your time in advance!

• ###### 1. Re: Pie Charts and Calculated fields

Hi, Kevin

If you'd like to keep the detail of the weekly metrics, it'll dice it by week. You may try level of detail calculation - if you can post a sample workbook, I'll try demonstrating creating the calculated field.

-Mia-

• ###### 2. Re: Pie Charts and Calculated fields

Hi Kevin,

Mia's right- level of detail calculations will solve this problem.  We can use LODs to calculate our number of records to the week level and then author our KPI calculation.

First, we'll need to create a new date part for just the week.  Right click on your date dimension, and select create-->custom date.  For this we'll select the date value of week numbers.

Now we can use this date part in our LOD expression.

{FIXED [Order Date (Week numbers)]: SUM([Number of Records])}

That gets us the number of records at the week level, and we can reference that calc in our KPI.

IF [Number of Records per Week] >= 45 THEN "High"

ELSEIF [Number of Records per Week] >= 25 THEN "Medium"

ELSE "Low"

END

If you want to see just one number for overall percentage of your groupings, you'll have to take the week field off of detail.  Hopefully that's okay, since we're already using the week count as part of the calculation.

Cheers!

• ###### 3. Re: Pie Charts and Calculated fields

Thanks for your input and level of detail! It looks like exactly what I need but I'm running Tableau version 8.2.7, which from my understanding does not support LOD expressions... Any suggestions from here? I'm doing some research as well in the mean time.