How do I get "Difference from min" in Google Data Studio? - max

I'm trying to convert my Klipfolio expression into a Google Data Studio chart expression for CTR Lift. CTR Lift is the percentage of difference each grouped result has from the minimum result. The expression is as follows:
&Column: CTR / REPEAT(MIN(&Column: CTR), COUNT(&Column: CTR)) - 1
I'm trying to recreate this as a chart field (it cannot be recreated as a data source field), but there's no "Difference from min" option:
Only percent/difference/percent difference from max is available, no min option:
How can I made Google Data Studio compare to min, instead of comparing to max?
I've tried things like 100 - AVG(CTR) or AVG(CTR) * -1, but they don't seem to match my Klipfolio data.

It turns out that AVG(CTR) * -1 is the correct syntax to compare to minimum, but I had to select, "Percent difference from max / Relative to corresponding data". The data set that I was comparing to to validate was inaccurate.

Related

In Google Sheets, how do we take a decimal feet value and turn it into properly formatted fractional Feet & Inches?

Been looking all over and nothing comes up as far as a Google Sheets formula.
Let's say we have a value of 3.6875 feet. We can use the number format # ??/??, but it will give us a fractional value in feet (in this case, 3 11/16 feet).
How do we "grab" the 11/16 and multiply it by 12 to get the inches value (8.25), and then the really tricky part, how do we display the whole enchilada as 3'8¹/⁴" (yes, including the superscript)?
A1= 3.6875
B1=INT(A1)&"'-"&TRIM(TEXT(ROUND(MOD(A1,1)*12*16,0)/16,"# ??/??")&"""")
Output: 3'-8 1/4 "
UPDATED:
You can have a table to search the superscript
The idea to get the superscript: with above output (3'-8 1/4"): is to extract the fraction (1/4), search for the equivalent superscript in the table (¹/⁴), then replace it (3'-8 ¹/⁴"):
So basically we will need:
REGEXEXTRACT
VLOOKUP
REGEXREPLACE
SPREADSHEET DEMO: HERE
=arrayformula(
if(len(A2:A),INT(A2:A)&"'-
"&REGEXREPLACE(TRIM(TEXT(ROUND(MOD(A2:A,1)*12*16,0)/16,"#??/??")&""""),
"\d{1}\/\d+",
VLOOKUP(IFNA(
REGEXEXTRACT(TRIM(TEXT(ROUND(MOD(A2:A,1)*12*16,0)/16,"# ??/??")&""""),
"\d{1}\/\d+"),
"0/0"),
TABLE!A:B,2,0)),""))

Box-Cox Transformation in SPSS

I transformed my stat data with logarithm, square root,... but my dependent variable doesn't achieve normality distribution yet.
Then, I know that the Box-Cox transformation permit us to find out the best transformation approach in order to achieve normality distribution and therefore apply parametric test such as ANOVA.
Can anybody help me in how I can perform this Box-Cox transformation in SPSS software? It is possible to apply through its syntax?
There is a Box Cox transformation syntax on Raynald's SPSS tools website. The data are just to give an example.
I added some simple syntax to easily see the results.
* Box-Cox transformation for all 31 values of lambda between -2 to 1
(increments of .1).
* Raynald Levesque 2003/11/08.
* http://www.spsstools.net/en/syntax/syntax-index/compute/box-cox-transformation/
GET FILE="C:\{SPSS user folder}\Employee data.sav".
COMPUTE var1=salary./* salary is a skewed test variable.
VECTOR lam(31) /xl(31).
LOOP idx=1 TO 31.
COMPUTE lam(idx)=-2.1 + idx * .1.
DO IF lam(idx)=0.
COMPUTE xl(idx)=LN(var1).
ELSE.
COMPUTE xl(idx)=(var1**lam(idx) - 1)/lam(idx).
END IF.
END LOOP.
* visual examination of results.
EXAMINE
VARIABLES= salary xl1 to xl31
/PLOT=NPPLOT
/stat descrip.
* numerical examination of results.
FREQUENCIES
/VARIABLES= salary, xl1 to xl31
/FORMAT= NOTABLE
/STATISTICS=SKEWNESS KURTOSIS.
The numerical examination works best after having copied the results in a spreadsheet.
This worked for me: "Go to Transform – Prepare Data for Modelling Automatic from the drop down list. In the Fields tab you can specify which variables to transform by moving them to the Inputs box. In the Settings tab click on Rescale Fields. Tick the box before ‘Rescale a continuous target with a Box-Cox transformation to reduce skew’. Click Run. This will create a new column with the transformed variable."
From: https://www.researchgate.net/post/How_can_I_do_Box-Cox_transformations_in_SPSS
You might want to double check with another source.

Crystal Reports Not Rounding Correctly

I have a formula which is simply 28742.92 / 100.
I have rounding which is set to 0.00001 however it outputs the value 284.
Is it possible to output decimal values as it appears in a standard calculation e.g. 28742.92 / 100 = 284.7289
Many Thanks.
Right click on your numeric field and choose the 4th option from the top Customize field.
Once done, choose the way you want to format your number

Deceptively puzzling : Sudo-code (or C#, linq) for paging algorithm like Google

I've racked my brain over this one and it's harder than it looks.
Please could some hardcore hacker out there show me a nice way to implement the following:
Given an indexed list of unknown size And a known max range size [say
10] (page size, i.e. how many results will be returned) When I give
this function an index (within the range of the indexed list) Then it
will return me a new range And the returned range should be of size
10, if possible And the returned range should always try to include
5 indexes before the input index And the returned range should try to
include 4 indexes after the input index
To see this working, goto Google and search for something. You get a set of results with some links (1 - 10)
When you click any link after page 6, the results will always have five links before and four links after the current page.
I just want to see how this is done, logically.
If anybody has a cool linq suggestion then I'd be really grateful.
I've already made this code work, but it's verbose and with lots of 'ifs' and 'elses' - I just know there's an elegant way to do it.
The problems I found where:
(1) Having a range that's less than the offset (i.e. only three results).
(2) Entering a index that's very close to the start or end of the input range.
I've searched the net over and over but can't find a simple (language agnostic) way to express this logic.
Thanks,
You can use a max function (language agnostic) to achieve this.
start_index = max(1, index - offset)
end_index = index + offset

SSRS 2008: Using StDevP from multiple fields / Combining multiple fields in general

I'd like to calculate the standard deviation over two fields from the same dataset.
example:
MyFields1 = 10, 10
MyFields2 = 20
What I want now, is the standard deviation for (10,10,20), the expected result is 4.7
In SSRS I'd like to have something like this:
=StDevP(Fields!MyField1.Value + Fields!MyField2.Value)
Unfortunately this isn't possible, since (Fields!MyField1.Value + Fields!MyField2.Value) returns a single value and not a list of values. Is there no way to combine two fields from the same dataset into some kind of temporary dataset?
The only solutions I have are:
To create a new Dataset that contains all values from both fields. But this is very annoying because I need about twenty of those and I have six report parameters that need to filter every query. => It's probably getting very slow and annoying to maintain.
Write the formula by hand. But I don't really know how yet. StDevP is not that trivial to me. This is how I did it with Avg which is mathematically simpler:
=(SUM(Fields!MyField1.Value)+SUM(Fields!MyField2.Value))/2
found here: http://social.msdn.microsoft.com/Forums/is/sqlreportingservices/thread/7ff43716-2529-4240-a84d-42ada929020e
Btw. I know that it's odd to make such a calculation, but this is what my customer wants and I have to deliver somehow.
Thanks for any help.
CTDevP is standard deviation.
Such expression works fine for me
=StDevP(Fields!MyField1.Value + Fields!MyField2.Value) but it's deviation from one value (Fields!MyField1.Value + Fields!MyField2.Value) which is always 0.
you can look here for formula:
standard deviation (wiki)
I believe that you need to calculate this for some group (or full dataset), to do this you need set in the CTDevP your scope:
=StDevP(Fields!MyField1.Value + Fields!MyField2.Value, "MyDataSet1")

Resources