4 Replies Latest reply on Nov 27, 2012 12:08 PM by Nelly Snarskaya

Can't build a pie chart

Hello,

There is next dimensions : user id and dates of purchases.

I want to divide users into two groups: those who made a purchase in the next 15 days and those who have not made. After that I want to count the number of users in each group and build a pie chart.

Firstly, I use the following calculation called "absence": from the current time subtract the date of the last purchase. Secondly, I take a minimum value of it. Then, I use the following function: IIF ([absence] <15, 'Active', 'Inactive'). So for each user there is label "Active" or "Inactive". But I don't understand how to count number of users in this groups.

I'm a novice at Tableau and will be very grateful

• 1. Re: Can't build a pie chart

Hi N h,

What is calculation that is being used from absence?

Would it be possible to post the packaged workbook (twbx file) or a sample workbook?

-Tracy

• 2. Re: Can't build a pie chart

Hi, Tracy.

Sorry I can't post workbook.

But there is absence function for another case = DATEDIFF('month',[purchasetime],NOW() ). Here I divide users into two groups: those who made a purchase in this month and those who have not made.

After that I use function
active_inactive = IIF ([absence] =0, 'Active', 'Inactive').

Next I tried to do something like this:

active = IF ([active_inactive])="Active" THEN COUNTD([user_uid]) END.

It gives me NULL value, but when I output user_uid and active_inactive in text table some people have label active and some - inactive.

I think that my last function is wrong but I don't know how to fix it.

Nelly

• 3. Re: Can't build a pie chart

Hi Nelly,

I have reattached a sample workbook using Superstore. The third calculation needs to be a count distinct of the Active or Inactive calculation. Then, place your user_id on the level of detail shelf (in this case State) and Active or Inactive on the color shelf.

Hope this helps!

-Tracy

• 4. Re: Can't build a pie chart

Tracy,

Thank you very much!

My mistake was that I took a minimum of absence, so active_inactive was in measures and not in dimensions so i couldn't use it in pie chart.

Nelly