Subtotal for ATTR function - tableau-api

I am trying to create a subtotal row after running total calculation. However, subtotal calculation doesn't seem correct.
I have two calculation fields. First one is to calculate running total of count of distinct emails.
Second calculation field is to use running total multiply by another field "charge quarterly".
In my final output, i also segment by cost center ID and licensing role ID. Number looks correct for "calculation 2" calculate field and non-subtotal total charges field. However, subtotal calculation for total charges field doesn't look correct. In some cases, subtotal doesn't even show up.
Can someone help me on how to add correct subtotal here?
Thanks

Use the subtotal provided by tableau
Tab
-> Analysis -> Totals -> Add all subtotals

Related

Side-by-side bar chart: One with the current filtered selection and one for total

I calculate the percent of total number of active customers for each SalesOwner in one of my Workbook sheets:
As you see, I have also added the SalesOwner as a filter.
The calculated field (segment_active_members) is computed using the following formula:
COUNTD(wk_customer)/ SUM({FIXED : COUNTD([wk_customer])})
What I want to do is create a side-by-side bar chart where upon filtering one of SalesOwners, I am able to compare it with the total (100%). So if I filter the above sheet by SalesOwner X which takes 5% of total. I'd like to see only two bars with one having 5% of the other one's length.
So I add another calculated filed to the above scenario where a fixed total is calculated:
SUM({FIXED : COUNTD([wk_customer])}
We will have a new column in the above picture with a fixed value of 100% for all rows.
I get what I want when my filter is on "All".
But as soon as I select a single filter (SalesOwner), my first percentage is also changed into 100% and I can never compare it to total.
How can I show the percentage against total for single segments?
This could be one of the solution:
Change the calculation of segment_active_members as follows
SUM({FIXED [Sales Owner]: COUNTD([wk_customer])})/SUM({COUNTD([wk_customer])})
Remove the table calculation for segment_active_members in the Measure Values shelf
You'll see that you are able to filter it down without any problem now
Cheers!

Tableau calculation: I am trying to calculate the percentage of running sum but am unable to create a calculation

I am trying to calculate number of customers which represent 80% of the profit so that I can use it in a calculated field which I can use in a reference line.
This is what I wrote
IIF(RUNNING_SUM([Profit])= (0.8*SUM([Profit])),
COUNTD([Customer Name]),0)
but it gives me error saying
"All fields must be constant or aggregate when using table calculation functions"
The logic is to "Count distinct number of customers which represent 80% of running total profits"
This is meant for a pareto chart, so the values are already sorted in descending order for it to work.
How do I create such calculated field which would give me number of top customers which will represent 80% of the profits?
Let me know if more clarifications are needed.
I think you are looking for a Pareto Chart. This might help:
http://www.theinformationlab.co.uk/2014/08/27/pareto-charts-tableau/
I would leverage the power of Table Calculations, where you can first do running total of profit and then simply calculate percentage of total.
Here is the link to step-by-step tutorial in Tableau10 for Pareto Analysis (80/20 rule):
https://www.tableau.com/learn/tutorials/on-demand/pareto-charts?signin=15df68b66e703787258911e79db040a7.
Hope this helps.

Calculate the Average of multiple Averages

I need to calculate the average of multiple averages within Crystal Reports with specific criteria. My report averages scores for multiple courses by a developer. I need to get the average value of the averages, based on the number of courses for that developer:
Course 1 10 responses Course 1 Average 42.86
Course 2 12 responses Course 2 Average 39.36
How do I create a formula that give me the correct Average ((42.86 + 39.36)/2) of those two courses for that developer?
Try a Running Total for that field, where the Type of Summary is set to "Average". Specify that the total should reset every time it reaches a new Developer group.
Sometimes Crystal won't let you summarize a summary. If it gives you guff, you can achieve the same effect with Shared Variables. Simply add each average in turn to the shared variable, then divide by a distinct count of averages. The final Formula field would look something like:
Shared NumberVar sum;
Shared NumberVar count;
sum/count

Different Total Types in Tableau

I am trying to use Tableau's row total function but am running into a challenge. In the same widget I have Rows 1 - 4 with Numbers. Row 5 is a percentage.
What I would like to do is have Rows 1 - 4 use a Sum Total and Row 5 use an Average total.
Any suggestions on how I can do this?
Thanks,
I don't believe you can use different total metrics on the same worksheet.
What you can do is to create 2 different worsheets, and bring them side by side on a dashboard. Then use the proper Total metric in each.
But beware on calculation average of percentages, because they might be twisted. Usually weighted average is required to accurately express the "average" of a percentage.
What you can do is to actually calculate the percentage (use a calculated field) via the division of two metrics. That way, when you do Totals you will actually a valid value for the "average" of the percentage.
As an exercise, suppose you have sales (in $) in first row, and # of clients in row 2. Now I create a calculated field called ticket, that is
SUM(sales) / sum([# of clients])
That way I can add that to a third row, and for each column I'll have the right number of ticket, and if I add a Row Grand Total, I'll get the actual average ticket value (that is total sales / total # clients), because Tableau will sum all sales, sum all # clients and them perform the calculation (the division)

Calculating Sub-totals as a percentage of Grand-total in Crystal Reports 2008

I know this has been asked time and again by people all over the net, but I can't for the life of me figure out why my solution isn't working.
I have a bunch of groups, and in each group's footer I have a running total which acts as a sub-total for that group. At the very bottom of the page, I have a running total which adds all these sub-totals together to give a grand-total. This all works great.
To the right of each sub-total (group footer), I have a formula field which calculates what proportion of the grand-total this sub-total represents.
i.e. if the Grand-total is 4, and the sub-total is 1, the formula field displays 25%.
The problem is that for each group in the report, the Grand-total hasn't yet been fully counted (until the last group), and so the percentages are being calculated against incomplete Grand-totals.
To combat this, I've tried using the WhilePrintingRecords; function on my percentage formula fields to ensure that the sub-total percentages are not calculated until the 2nd pass of the report, by which time the Grand-total should be fully calculated.
WhilePrintingRecords;
If {#LoggedToday} > 0 Then
{#LoggedToday} / {#TotalLoggedToday} * 100
Else
0
It's not working though! It's literally had no impact what-so-ever :o(
Does anyone have any idea where I'm going wrong here?
Thanks.
Yes, you're using a running total to calculate a grand total.
Instead, I suggest creating a Crystal formula for your percentage, in the form:
Sum ({ numeric field }, { grouping item }) % Sum ({ numeric field })