Google Data Studio, how to get a sum of all Max or Min values - google-data-studio

I am working with a data set where i have to get Min or Max for different text fields. My dataset can have thousands of rows so below is a simpler example. So I have 3 categories having multiple values and I can put this dataset in GDS to build a table where I select Category as dimention and Value as Max(Value) in metric.
Now I need to see the sum of all those values too. But like the pivot table in excel, the subtotal in GDS shows the Max out of all the max listed above. So instead of 65, it shows 30 in GDS. Is there a way I can get it to show the sum?

To reach the desired result you will need:
Make a data combination, not being necessary to insert a second base, just so that a current base is defined as a data combination.
In the combination use the Category dimension and define the Max Value metric. The combination is only necessary for the metric to be used in the table as a dimension (this is a property resulting from the combination of data).
Configure the table with the Category dimension and Include the metric with the Value sum option. Remember that now Value is the maximum value (as defined in the data combination).
Finally, display the Summary line. And the desired result is obtained

Related

How to specify a column field in a calculated field formula when you have the same value evaluated as a count and a sum?

I am using a pivot table to summarize our status of completion of a project. The first value of the pivot table gives me a count of the entries in the spreadsheet column that have a value greater than 0. The next value of the pivot table gives me a count of the total estimated quantities from the spreadsheet. The third value gives me the sum of the entries from the same column of the spreadsheet that the first value uses in the pivot table. The final value of the pivot table is a sum of the total estimated quantities from the same column from the spreadsheet the second values uses for the pivot table.
My current working formula will only evaluate the SUM columns in the pivot table and is the following:
=iferror('Quantities Complete'/'Total Est Quantities',0)
This gives me a percent complete based on the SUM of those two columns from the spreadsheet. These values can differ because the first is a real value and the second is an estimated value. What I want is the below formula which I will put how the data is summarized in parenthesis for simplicity of understanding.
=if('Quantities Complete'(COUNT)='Total Est Quantities'(COUNT),1,iferror('Quantities Complete'(SUM)/'Total Est Quantities'(SUM),0))
This formula would allow me to evaluate if the count of complete items matches the total estimated items, if so the calculated field value is 100% regardless of actual sum values. Otherwise, it gives a percent complete based on sum value which is more accurate because each item can have vastly different values.
How can I refer to the 2 different uses of the columns in a calculated field formula?
I have tried the renaming the column headers to 'Items Complete' and 'Item Values' but the formula does not accept those and gave a parse error. I have tried using the "COUNTA of" or "SUM of" prefix for the column fields. I also tried typing the name as shown when I hover over the value field in the edit window which I tried in these methods: 'Quantities Complete' (Items Complete) and 'Quantities Complete (Items Complete)'. All of these yielded a parse error. I can't share my spreadsheet due to confidentiality requirements, but all I need to know is how to refer to the two different column headers that have the same name from what I can tell.

Arrays, SUM + INDEX/MATCH

Note: tried in Excel and Google Sheets, but I have a preference for Sheets.
Basically I want to get the sum of a group of data using INDEX and MATCH (because the parameters are going to be drop-down dependent):
The desired result is:
So this will require a few things:
Converting the cell D13(April) to a Month
Converting the "weekof" column to a Month
Using INDEX and MATCH and MATCH again, I'm assuming because it's multiple cell references.
Here's my solution currently below:
=SUM(INDEX(D5:I9, MATCH(MONTH(D13&1),ARRAYFORMULA(MONTH(C5:C9)),0), MATCH(E12,D4:I4,0)))
This returns the NEAREST value:
270
Instead of:
804
Why this value?
270+500+34 = 804
If you are not strict to use INDEX and MATCH, you may use the following solution:
Add extra column name it "Month", this column will extract the month name from the date column using TEXT function as the following:
=IF(C3<>"",TEXT(C3,"mmmm"),"")
The if statements ensures that only filled dates will have a month value, since you have to fill this column with the above formula for a certain amount of cells.
Now you can simply use the SUMIF function in cell E13 or where ever you want:
=SUMIF(B:B,D13,D:D)
If you don't want the Month column to appear within your data table you may put it at the end of your table and hide it.
You could directly use FILTER then SUM the result instead to simplify your formula to this one:
Formula:
=SUM(FILTER(D:D, TEXT(C:C,"MMMM") = E13))
Output:
UPDATE:
The above formula should also update when the value is dropdown. Dropdown is just data that can be changed with predetermined values, aside from that, it should be the same when using a normal cell.
To match columns, use MATCH and INDEX together with the formula above. See modified formula below.
Be careful of the circular dependency. make sure your ranges doesn't interfere with the actual cell where you put your formula.
Column Matching:
=SUM(INDEX(FILTER(D:E, TEXT(C:C, "MMMM") = E13),,MATCH(F12, D4:4, 0)))
You can use pivot table and group dates by year and month.

Excel quartile function with variable array criteria (like countif)

hoping someone can help with my Excel query.
I want to use the quartile function (or similar, could use percentile if that's easier). I have data in a column but I want to limit the data I use from that column.
I have job departments in column A, people's salaries in column B (and other data in the other columns e.g name).
I want to use my one main data list (c. 2,000 rows) to pick out the quartiles for the 10 or so depts I have but I don't want to have to make 10 specific lists to calculate the quartile of each dept.
Is there an option to use a countif or similar function so that I can have a drop down list of my 10 depts and depending on what dept I select my summary table will show the quartiles relevant for just that dept?
Thanks
Use an array formula =quartile(if(A1:A1000=C2,B1:B1000),.75) press control + shift + enter after entering the formula. Note: C2 = the department which quartile you are calculating.

Generating Working Hours using SQL Server Query

I have this data and I need to generate a query that will give the output below
You can do this kind of groupings of rows with 2 separate row_number()s. Have 1 for all the data, ordered by date and second one ordered by code and date. To get the groups separated from the data, use the difference between these 2 row_number()s. When it changes, then it's a new block of data. You can then use that number in group by and take the minimum / maximum dates for each of them.
For the final layout you can use pivot or sum + case, most likely you want to have a new row_number for getting the rows aligned properly. Depending if you can have data missing / not matching you'll need probably additional checks.

How to create the value I want by combining two pivot tables

I have combined two datas which are price 2013 and volume 2013 to create one pivot table. But how can I find revenue (Volume multiply price) by using pivot table? Please help. Thanks. My column field there included Price from data 1 and volume from data 2.
Switch one of the fields to Σ Values (Volume would seem to be the more sensible) and add a Calculated Field (PivotTable Tools, Options > Tools - Formulas) say Named: Revenue and with Formula: Volume*Price.
However depending upon your version of Excel and your data, you may receive incorrect results (eg in the GT row for revenue).

Resources