I need to create a table that will calculate the percent of one column from another column. The problem is that those column are calculated by pivot table so i cant use the calculated filed on them( it gives me only the fields that are on the table connected to the pivot table).
I have tried to do this calculation by taking the pivot table to the power query but when i update the database it does not update the calculation in the power query
what is the most simple way to do this calculation?
thanks!
liron
If Power Query is reading cells from your pivot table in an Excel workbook, then you'd need to first refresh the pivot table and then Power Query.
Alternatively, Power Query can directly read from most databases. Why not just do the pivot directly against the database table from Power Query, and then the percent calculation will always see the latest data.
Related
I have a Google Sheet with daily ranked items expanding with new data everyday in the Raw Data Table A2:C.
I would like to generate a report matrix similar to table in E2:J using one formula so that we don't need to manually copy formulas in each cells in the report table from time to time.
It would be ideal to have one formula at cell E2 (or E3, F1, F2) only that will automatically generate as many rows and columns in the report table based on the data in Raw Data Table. This way, the report table will not needed to be maintained on a daily basis (like copying formula everyday as data expanded).
There are less elegant ways to do it like pre-copy formula into a large number of cells or using Google App Script to generate the table. However, I believe an advance query() or a complex formula mixing query(), filters() and/or arrayformula() can do the job! Just wonder if anyone of the Google Sheets query() expert can help!
try:
=QUERY(A2:C; "select A,max(C) where A is not null group by A pivot B"; 1)
Here's a possible solution:
=ArrayFormula(LAMBDA(dates,ranks,{A2,ranks;dates,IFNA(VLOOKUP(dates&ranks,{A3:A&B3:B,C3:C},2,0))})
(UNIQUE(A3:A),TRANSPOSE(UNIQUE(SORT(B3:B)))))
I am trying to fix an error in googlesheet especially related to Pivot table. Especially when I make extra calculations from the Pivot table I get the #Div error when I filter on basis of few parameters. But if I make it without any filters I do get proper results.
I am looking for a solution where the calculations can take particular cell values with respect to cell column name only. So I can make a better calculations without any type of filters or shiftings. This is a dynamic case.
Can anyone suggest any better answer?
https://docs.google.com/spreadsheets/d/1h1TdFLj3JyK6-oxOOswuWDx4YixzG51H2rWgK0BbD2s/edit#gid=925622507
#DIV error is the result of trying to divide an empty cell with another empty cell
it's a standard issue equivalent to dividing 0 with 0. such math is not logical and google sheets will flag it as an error to alert you.
however, the true culprit is that #REF error:
filters of pivot table cant produce/create additional columns. pivot table will just roll out data wherever it needs. in your scenario pivot table attempts to roll out date into 3 columns but only two columns there are empty. 3rd column (C) is filled with data/formulae and pivot table cannot move data or delete data so if there is no space to roll out it will #REF error to alert you that something went wrong.
possible solution: move C, D columns to the right. if you are not able to predict how many columns will filter of pivot data roll out into then have som extra space between and for the visuals you can hide those empty columns
I have created a pivot table in data-studio from a google sheet. Another sheet in the same workbook contains a table that has a column named total. I want to show this total column beside the "column grand total" of the pivot table created from the first sheet.
Can this be done using data blending? If yes, how can I do it?
link to GDS report : https://datastudio.google.com/reporting/9e869103-e0f8-43eb-a0d2-0147ef4628cf
Desired outcome:
According to your data, Class A and Class B are join keys (since they are the data data appear in both data sources); Class C and Totals are dimensions (you can treat Totals as a metric, the result will be the same); and Record Count is a metric.
Knowing this, everything you need to do is to blend your data, as follows:
Using this new data source in a pivot table, add Class A, Class B and Totals as row dimensions of your pivot table, Class C as column dimension and Record Count as metric. The result should be:
Obviously, you can't have everything you want. In a pivot table, row dimensions appear first, then metrics and totals. It doesn't make sense to add it as the last column as you want, at least not with standard controls.
I have a big sheet with quite a lot of info that keeps growing over time. Based on that, I have created several pivot tables that do some calculations and rankings.
Every ranking keeps growing, so pivot tables may contain 10 rows now, but can grow up to 20 or 30 rows.
I managed to insert several pivot tables in the same sheet and now it looks well, with every ranking after the next one. However, if I add multiple rows, the pivot tables grow and start overlapping, so after a while the ones below start disappearing in favour of the first ones.
Is there a way to have multiple pivot tables in the same sheet with a fixed number of rows among them, preventing them from overlapping?
If you want to 'play' with the data, I created a sample in https://docs.google.com/spreadsheets/d/1MVX3tp6GIqVX6hTyk6TsCxV7YngiMpi7E8oSxa7a9ck/edit?usp=sharing. It is just a ranking on races, where I want to track the best times on different legs. Then it has a second sheet 'rankings' in which I have different pivot tables, one for each leg.
HOw's this for a single formula solution that will scale infinitely in users or legs:
=ARRAYFORMULA(QUERY(SPLIT(FLATTEN(results!A2:A&"|Best of "&results!D1:1&"|"&OFFSET(results!D2,,,ROWS(results!D2:D),COLUMNS(results!D1:1))),"|",0,0),"Select Col2,Col1,MIN(Col3) where Col1<>'' and Col2<>'Best of ' group by Col1,Col2 order by Col2, MIN(Col3) label MIN(Col3)'Best', Col1'User',Col2''"))
You'll find it in cell B1 on the new tab in your sample called MK.Idea
I should mention that FLATTEN() is an undocumented function that I only recently discovered. I've believe it is intended to remain "hidden" in the back end of the sheets programming, but if what I did is what you're after, there really isn't a more efficient way to do it. I've spoken with an engineer at Google who was surprised it existed as well and told me there were no plans to deprecate it, so here's hoping! For a demo of what it does generally, you can see my sample here:
https://docs.google.com/spreadsheets/d/196NDPUZ-p2sPiiiYlYsJeHD6F_eJq7CWO_hP7rFqGpc/edit?usp=sharing
Spreadsheets and Pivot Tables are marvelous tools for data analysis but they aren't too friendly for creating reports and dashboards, if you are open, to recommendations try Google Data Studio (it includes pivot tables too --> https://support.google.com/datastudio/answer/7516660?hl=en)
Let say that you don't have time to learn another app or you just prefer to keep using spreadsheets, in this case it will be required to implement a workaround.
First, bear in mind that Pivot Tables don't actually overlap, instead an error message is shown:
Solution: insert some rows/columns to give enough room to the Pivot Table to be expanded.
NOTE: You could do this in advance by including a "safe zone" (meaning blank rows /columns) around the pivot tables. You could hide/unhide this "safe zone" as needed.
If you don't want to do the above manually, I think that it should be possible to use an on edit trigger of Google Apps Script to detect that pivot tables are shown and insert new rows/columns to avoid this. If the Pivot Table top left cell returns #REF! your script could use a do.. while or a while to insert the required rows or columns. An smart algorithm will read the Pivot Table settings to calculate the required rows and columns and then insert the required rows / columns in one pass.
Related
Pivot table with Google Script
I am using power query to get my tables from an external workbook. When I create a slicer for one of my pivot tables the other pivot tables don't show up in the pivottable connection. I want to have one slicer for multiple pivot tables and I am not sure why the pivot tables isn't showing up. Any help would be awesome!
A slicer can only connect to a pivot table that uses the same pivot cache. Chances are that if you don't see the other pivot tables in the slicer connection, they are using a different pivot cache.
If you use Power Query to get the data, make sure that you add the query to the workbook data model. Pivot tables that are created from the data model will share the same pivot cache.
Given you don't have PowerPivot installed (or don't have the DataModel that is built in to Excel 2013 or later) then you've got two options:
Join both data sources in PowerQuery on a common field, so that you
bring in just one Table. Then everything will be on the same
PivotCache (allowing Slicers) if not PivotTable.
Use one VBA routine to limit slicer selection to one item only, and another routine to sync slicers across different PivotCaches.
If you elect for the latter, then Jerry Sullivan's code from this link will limit users to selecting just one item in a Slicer, and my code from https://stackoverflow.com/a/39604425/2507160 will then show you how to sync this Slicer to other Slicers on different PivotCaches, in order to keep all Pivots showing the same thing.