I'm trying to turn a cross table that looks like this
into a table which shows the subtotals and percentage over each Group like the example below
Where the percentage is the sales of each product divided by the total sales in each group, so for Product A = 20 / (20+40+30) = 22%
So far, I've managed to use Spotfire built-in subtotal function and the following expression to almost achieved the table I want
Sum([Sales) / Sum([Sales]) OVER (Intersect(Parent([Axis.Rows]),All([Axis.Rows])))
but the only problem is that the percentage for my subtotal row doesn't seems to equal to 100%, instead it is taking the subtotal sales divided by the grand total for all groups, meaning 90 / (90+140) = 39%
Can anyone advise me where did I go wrong and how do I resolve this? Thanks
You didn't go wrong anywhere but your subtotals aren't going to work out how you want. The Subtotals are calculated by Spotfire automatically on the underlying grouped data. So in this case, the subtotal is going to be for the first node of your hierarchy (group). i.e. Groups 1 and 2. You aren't going to be able to change it with your current layout. As you know, subtotal is a portion of the grand total. Grand total is for the entire Cross Table, which will be 100% no matter what your data is. Thus, it's impossible for the sums of 2 or more subtotals to be > 100%. Your subtotal is the SUM of the values calculated off of this formula:
Sum([Sales]) THEN [Value] / Sum([Value]) OVER (All([Axis.Rows])) as [% of Total]
Related
This is related to this question, though it is looking for a way to get the Column Total using DAX instead of Grand Total.
So, is there any way to get a % of column total using a calculated measure, in a field agnostic context (i.e. regardless of which field is placed where)?
The ultimate objective is to create a pivot table that looks at the % of sales for a variety of product x country x customer combinations. What I would like to do is have the option to place these fields either in the Filter or the Row section of the pivot table, and have a measure that calculates the sales as a % of the column sum.
The show as % of column total functionality is OK when using it to show the %, but not when one wants to use that % in other calculations (e.g. margin variance analysis)...
An answer to a similar question I found online recommended something along those lines:
% Total = [TotalQuantity] / CALCULATE( [TotalQuantity] ,ALLSELECTED( 'Table'[FieldUsedOnRows] ) )
This works great with a single field in the rows section, but does not work when a second (or third) filed is added as a row... in that case the formula does not behave as %of column total, but as % of parent row.
Does it mean then that there is no way to get a % of column total without having to explicitly specify all fields?
Any advice would be much appreciated!
Thanks a lot in advance!
-N
Not sure if this is possible in a saved search, but I want to run a calculation off the summed summary results and display it on the same line. I have a SUM of quantity column and a SUM of quantity fulfilled. I want another column that does qty fulfilled / qty as a percentage but it has to be calculated at the summary level.
Any help would be greatly appreciated.
formula
results
Basically I want to do the following but based on the summary data only, in order to calculate the total fill rate (fulfilled/qty ordered) rather than an average fill rate per order. I don't know if it's possible in a summary saved search.(NVL({quantitycommitted},0)+NVL({quantityshiprecv},0))/NULLIF({quantity},0)
With the above and with the AVERAGE function, it's giving me the average of the individual order fill rates. I want the aggregate fill rate instead. If there are 10 orders and 9 filled at 90%, 1 at 0%, my current formula gives me 90%. But what if that 1 order had a way higher qty than the other orders? Then it would be misleading to show an average fill rate of 90% because on the order that counted, you missed all the sales.
Here's a similar logic you may use:
((sum({quantityshiprecv})/sum({quantity})) * 100)
#Dars is correct, but I thought I'd give you a picture of what that looks like in the NetSuite UI.
It doesn't matter what fields you Group by, and you can use the Minimum, Maximum, or Average Summary Type for your Formula (Percent) field
I have a group of data with the following fields:
Code, Product, Rate, Volume
Each code has multiple products. On each row of the pivot table is a code, and the table has a product filter. The Rate is the value in the table. I want that rate to change depending on a combination of products selected.
E.G. If Code A has:
Product A, 2% Rate, $1000 Volume
Product B, 3% Rate, $3000 Volume
Product C, 1% Rate, $1000 Volume
I want the rate field to display 2.4% when all are selected, 2.75% when A&B are selected, 1.5% when A&C are selected and 2.5% when B&C are selected.
How do I do this? Currently, I am only able to have the rate field display an average or a sum, which is not right. I.E. in the above example, average would display 2%, which is not accurate.
Its a little convoluted, but I think this gets at what you want.
In your original table of data, create a helper column that multiplies Rate by Volume. I will refer to this column as Helper.
Select your pivot table, then go to Analyze>Calculations>Fields Items & Sets> Calculated Field
Name your new field Weighted Average then for your formula enter Helper/Volume, then select Add
Your calculated field will now show the weighted average for each Code based on the filtered Products. It worked for your simple example, I would think it would work for your larger table.
I have a question about how excel calculates grand total in a pivot table. My values are percentages so a grand total doesn't make sense. When I am connected to the analysis cube from excel i got this grand total automatically.But the result doesn't make any sense. I have two columns with values 100% and 31.48% and the grand total is 31.52%.
Does anyone know how this result is calculated?
You can choose to remove grand totals from a pivot. As for %s, I did not manage to reproduce your results, I get Grand Totals of 272% (for rows of 85%,100%,87%) , 40% (0 , 0, 40) , 135% (46, 36, 53).
The exact mechanism is proprietary information and there is not enough information in the OP to be sure what is being calculated as a percentage of what else but the general principle is that Excel's PivotTables work on aggregated values.
Thus where the percentage is A of A+B, the following would give the results mentioned for two columns:
A B
100 0 100.00%
53,831 117,169 31.48%
and the total percentage [calculated as: 100*Sum(A)/Sum(A+B) ] be the result mentioned for Grand Total:
53,931 117,169 31.52%
In effect weighting has been applied. This behaviour is consistent with other PT display options.
As described for Calculated Fields at Contextures:
the individual amounts in the other fields are summed, and then the calculation is performed on the total amount.
I have created a power pivot table as shown in the picture. I want to calculate quarter over quarter sales change. For which I have to divide for example corporate family "Acer" 's sales in 2012Q4 by sum of all the corporate family. I am using calculated measure to do this, but I am not sure what formula I can use.
My need is to create two columns, one for 2012Q4 percent of total and one for 2013Q1 percent of total. Then I will create another measure to find the difference. So the formula for 2012Q4 should be like this 1624442 / (1624442+22449+1200+16123) . Any idea which function can help me do it?
It sounds like you are measuring the change in the percent of total for each corporate family from quarter to quarter. You will need to create 3 calculated measures. I'm not sure what your model looks like so I can't give you the exact formula, but here is the idea.
CurrentQtr%ofTotal:= Divide(Sum('Sales'[Units]),Calculate(Sum('Sales'[Units]), All['Product'[Corporate Family])))
PrevQtr%ofTotal:= DIVIDE(CALCULATE(Sum('Sales'[Units]), DATEADD(DimDate[DateKey], -1, QUARTER)),
CALCULATE(Sum('Sales'[Units]), DATEADD(DimDate[DateKey], -1, QUARTER), All('Product'[Corporate Family]))))
Change%ofTotal:= DIVIDE(([CurrentQtr%ofTotal]-[PrevQtr%ofTotal]),[PrevQtr%ofTotal])
I used the divide function because it handles divide by zero errors. You use the ALL function to remove the filter on the Corporate Family column from the filter context. The Change%ofTotal is just to find the differenc. I'm calculating % change but you may just want to subtract.
Here's the link to a good blog post on time intelligence. And here's one on calculating percent of total.
For percentages please follow the tutorial on the Tech on the Net.
Adding another column where you calculate a difference between two pivot columns will not work - this column is "unpivotable", as it relies on a column defintion. You would need to copy and paste pivot as values to another worksheet and do the extra calculation there.