I am trying to do a cross table with a column that calculates the percentage the column total (third column from the left). I've been trying to follow some examples found in my Google searches but can't seem to get it to work.
I tried to insert this custom expression in my subsets:
Count() THEN [Value] / Sum([Value]) OVER (All([Axis.Rows]))
But I get this error: The expression is not valid after 'THEN' on line 1 character 9.
If someone still trying to do this you can do this :
Count() then Sum([Value]) Over (AllPrevious([Axis.Rows])) / Sum([Value]) OVER (All([Axis.Rows])) as [Cumulative Sum]
That will give you this result :
Where you have "(Column Names)" in Horizontal, [country] in Vertical axis and the sum and cumulative sum in the Cell Values.
Related
I would like to know how does Excel think to calculate the values on the function PERCENTILE.INC. I'm making some studies on Percentile and Quartile, I got the below results:
How does Excel think to calculate the values on column F?
Here's the formulas I'm using:
=PERCENTILE.INC(B2:B21; 0,75) ==> F2
=PERCENTILE.INC(B2:B21; 0,50) ==> F3
=PERCENTILE.INC(B2:B21; 0,25) ==> F4
=PERCENTILE.INC(B2:B21; 0,00) ==> F5
Short answer - the position of a given percentile when the data is sorted in ascending order, using percentile.inc, is given by
(N-1)p+1
where p is the required percentile as a fraction from 0 to 1 and N is the number of points.
If this expression gives a whole number, you take the value at this position (e.g. percentile zero gives 1, so its value is exactly 22). If it's not a whole number, you interpolate between the value at the position given by the whole number part (e.g. for p=0.25 it's 5 and the value at this position is 52) and the value at the position one higher (in this case position 6 so the number is 55), then multiply the difference of the two values (3) by the fraction part (0.75) giving you 2.25 and finally add this to the lower of the two values giving you 54.25. A shorter way of saying this is that you go a quarter of the way between the two nearest values. So you have:
If you wished to show the logic as an Excel formula, you could implement the expression shown here on the right (where h, in the second column of the table, is the position calculated from the formula above and x is the value at that position)
like this:
=LET(p,J3,
range,I$2:I$21,
N,COUNT(range),
position,(N-1)*p+1,
lower,FLOOR(position,1),
fraction,MOD(position,1),
upper,CEILING(position,1),
lowerValue,INDEX(range,lower),
upperValue,INDEX(range,upper),
difference,upperValue-lowerValue,
lowerValue+fraction*difference)
I have a table in power query and I want to create a new column that displays the average of all values of another referenced column. Any idea how to achieve this? So for example the home.goaldFor column i want to add-up all values and devide by the number of values.
i have tried multiple ways, including this one:
Avg = List.Average(
Table.SelectColumns(
#"ENG - Premier League",
[home.goalsFor],
0
)
)
But that's giving me the error:
Expression.Error: A cyclic reference was encountered during evaluation.
Anyone any ideas ?
I suspect that #"ENG - Premier League" the name of the current step based on the error you're getting.
Try this instead:
Avg = List.Average(#"Previous Step Name"[home.goalsFor])
I created a saved search on sales orders to calculate days between order date and ship date, grouped and averaged by class (the formula is cased to distinguish between 'Wholesale' class and all others). The numeric formula is:
CASE WHEN {class} = 'Wholesale' THEN {actualshipdate} - {startdate} ELSE {actualshipdate} - {shipdate} END
The summary type for the formula result is average. The summary-level results have way too many decimal places. Is there a way to round the summarized results to a pre-defined number of digits?
I have tried using the ROUND() function, both inside the CASE statement and as a wrap-around. I've also looked through general preferences for rounding defaults and haven't found any.
In order to round the result, you should implement you own average calculation and rounding.
Add the following result field besides the class grouping field that you already have:
Field : Formula (Numeric)
Summary Type : Maximum
Formula : ROUND(SUM(CASE WHEN {class} = 'Wholesale' THEN {actualshipdate} - {startdate} ELSE {actualshipdate} - {shipdate} END) / COUNT({internalid})),2)
Basically, you are doing here your own analytics.
Since the results are grouped, each result fields contains the whole result set of this field which allows you to add analytical functions on this group.
The summary type is MAXIMUM, just in order to show one result, so it can also be min or avg, no difference.
The function is calculating the sum of your formula and dividing it by the records count to get the average.
I am trying to find x-axis(frequency) value that corresponds to max(y-axis)(amplitude).
But it is bit complicated the csv have 3 columns :
first - S/N
second - x-axis (frequency)
third - y-axis (amplitude)
the graph type is line and the "color by" is S/N column.
I tried to this IF statement:
If([signal_power [dBm]]]=Max([signal_power [dBm]]]),Max([signal_power [dBm]]]),-1000)
the to filter out all the "-1000" which will leave me only with the x-axis value that corresponds to the max(y-axis).
the problem is that the IF searches all over the S/N column.
thanks
Use (Max([signal power]) Over ([S/N])) instead max only, this will calculate max for each S/N value.
Tip: Instead of -1000 it's more elegant to use nul.
WARNING - Using Excel 2011 for Macs, inexperienced user
Hi All,
I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:
I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.
For example, the avg_click_rate of [years=5] is:
(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53
while the avg_click_rate of [region=north] is:
(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28
and the avg_click_rate of [years=5, region=south] is:
(0.5*10)/10 = 0.5
I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.
To be clear, my formula would be:
SUM{ (click_rate * number_members) / SUM{number_members} }
where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].
You should create a new column in your source table:
product = click_rate * number_members
And then create a Calculated Field in the pivot table:
CF = product / number_members
Using AVERAGEIFS:
AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)
EDIT:
You can add up to 127 conditions, see: AVERAGEIFS function
Criteria_range1, criteria_range2, … are 1 to 127 ranges in which
to evaluate the associated criteria.