Combine 3 different GSheets to one GDS table - google-sheets

I have 3 people working on different restricted tables with the same header and same structure and I would like to combine the tables into one GDS table.
https://support.google.com/looker-studio/thread/59556470/how-to-merge-multiple-datasets?hl=en
I tried to use Blend data in GDS and used Youtube but it seems like I am not smart enough. To combine all 3 tables into one table in GDS.
https://www.youtube.com/watch?v=f5zpJNMsJio instead of using the array GSheet function I would like to combine the 3 tables into GDS
TL;DR: 3 GSheet tables with roughly 300 lines combined into one GDS table with 900 lines ;)
Can somebody please help me :)
I used to blend data but instead of combining the 3 tables I got 1 table with a couple of headers

You may try the following steps to blend and vertical stack the data of 3 separate datasets.
connect your 3 datasets to datastudio
create a blend with Full Outer Join of the 3 data sets as shown in the screenshot below
use COALESCE Fx on both the dimension & metric to stack them as single dataset
dimension
COALESCE(Sales Person (Table 1),Sales Person (Table 2),Sales Person (Table 3))
metric
COALESCE(Sales (Table 1),Sales (Table 2),Sales (Table 3))
-

Related

Google Sheets: Many to Many Table Join

I am trying to create a sheet to determine the amount of overlapping hours for employees.
I have one table with timeclock data for the Employees.
Table 1
And another with timeclock data for their Support Staff.
Table 2
This is the desired output. Each row from table A has all the date matches from table B. From here I would compute the number of overlapping hours in the final column and then roll that up into another sheet.
Table 3, Desired Output
(apologies for image links, I can't post inline images yet)
Sample sheet here Please let me know if you have any ideas for me!
I know its a combination of QUERY, ARRAYFORMULA, FILTER and more but I just can't find the right combo.
Here's a way of doing this type of join using only built-in functions:
=arrayformula(lambda(employee,support,
lambda(datecomp,
lambda(rows,
{vlookup(index(rows,,1),{row(employee),employee},sequence(1,columns(employee),2),false),
vlookup(index(rows,,2),{row(support),support},sequence(1,columns(support),2),false)})(
split(filter(datecomp,datecomp<>""),"|")))(
flatten(if(index(employee,,1)=transpose(index(support,,1)),row(employee)&"|"&transpose(row(support)),))))(
Employee!A1:D6,Support!A1:E5))
There's a lot going on here, but the basic idea is that we are comparing the date columns of each table against each other in a 2D IF array, and where the dates match we are obtaining the row index of each table. After some manipulations we can use these row indexes on each table in two side-by-side VLOOKUPs to obtain the joined table.
DMac,
I wrote myself a QUERY replacement custom function that uses real SQL select syntax.
For your data it looks something like (You need a tab called employee and a tab called support for this to work) :
=gsSQL("select * from employee full join support on employee.date = support.date")
See my test worksheet: (line 164 on gsSqlTest sheet)
https://docs.google.com/spreadsheets/d/1Zmyk7a7u0xvICrxen-c0CdpssrLTkHwYx6XL00Tb1ws/edit?usp=sharing
You need to add one Apps Script file to your sheet to give you the custom function:
https://github.com/demmings/gsSQL/blob/main/dist/gssql.js
For more help using more features see:
https://github.com/demmings/gsSQL
For example, changing the column titles, it would be like:
select employee.name as name .... (rest of your select).

Repeat Columns of equation across rows infinitely

In Google Sheets, is there a way I can repeat columns of equations across rows laterally??
In [Pic1], I have a set of data from A1:C (in red color), listing out employee no., name and salary.
Below is the equations in yellow to show data in A10 =QUERY($A$2:$C$7,"Order by A Desc"), the equation in D10 is to multiple employee salary by 2 times =C10:C*2
Is there a way / any forumula I can type to keep on repeating A9:D set of equations across rows laterally like in [Pic2] (yellow)?
Manually copying and pasting across rows is very troublesome if copied in large amounts. It would be great is there is a formula way to achieve that.
try like this:
={A9:D, A9:D, A9:D, A9:D}
To concat multiple arrays horizontally, we can use array literals {arr1,arr2}. To automate this process, we can use REDUCE to loop and accumulate the arr multiple times:
=REDUCE(arr,SEQUENCE(number_of_times_to_repeat-1),LAMBDA(a,c,{a,arr}))
Sample:
To repeat A9:D three times,
=REDUCE(A9:D,SEQUENCE(2),LAMBDA(a,c,{a,A9:D}))

Google Sheets: Have functions create cells if they run into existing data

This might not be possible, but I was curious if there was a way to make functions like =FILTER() and =UNIQUE() to create new cells if they run into data they cannot overwrite? I have a database composed of items from multiple sheets and as of right now I'm only able to use one filter function because of the nature of what I'm doing. Would be most convenient if something like this does exist, but a rather extensive round of google searching turned up no results
no, this is not possible, however, if your formulae are of the same size you can stack them up so if your dataset will grow then new rows should be auto-added. for example, if you have FILTER that outputs 3 columns & 5 rows today but tomorrow it will output 10 rows and under it you got UNIQUE that also outputs 3 columns & n rows, then you can do:
={FILTER(A:C, A:A<>""); {"","",""}; UNIQUE(D:F)}
{"","",""} acts as empty row as separator

How to show fusion table rows that ST_INTERSECTS multiple possible locations in a single layer?

I have a pretty routine fusion table that contains rows of data where each row has a location column that contains a polygon (or multiple polygons in a multigeometry). I use this fusion table data to draw polygons on a google map object within a web page using google.maps.FusionTablesLayer. Creating a query that uses a single location as a CIRCLE with a small radius within an ST_INTERSECTS is a trivial exercise and works perfectly.
However, I now need to be able to query all rows within the fusion table that intersect multiple possible locations (essentially the results of a geocode of a search term). Each row need only intersect at least one of the locations to be included in the result set.
Things I have already tried and or considered ...
1) Multiple layers don't work as I would be limited to at most 5 locations and only one of them can be styled the way I need.
2) Building a LatLngBounds with each location then doing an ST_INTERSECTS on the RECTANGLE formed by the bounds. As is obvious once you do it, this shows you all polygons that are between two distant locations, but don't actual contain the locations (because we're now looking for polygons intersecting a large rectangle around the two points) - something I don't want.
3) You can't do "ST_INTERSECTS(GEOMETRY, CIRCLE(location1, 1)) OR ST_INTERSECTS(GEOMETRY, CIRCLE(location2, 1))" <= This would be the perfect solution if it worked!
4) You can't do an SQL union with a fusion table query.
5) You can't do multiple SQL selects within a single fusion table query.
Is there any way I can do this within a single fusion table layer?
Thanks in advance for any input!
I'm afraid the only possible solution here may be to request first the rows(a unique column with an ID, but not the internally stored rowId ), single requests for each location.
When you got all the results, build the query for the FTlayer based on the returned ID's , a'la:
where: "columnWithIds IN('collected','ids','from','the','previous','requests')"
If this will be applicable in your situation will depend on
the number of locations(limits for webService-requests)
the number of returned rows(browserLimit for URL-length)

Query or filter on Fusion Tables?

this a question from a very inexperienced user.
I have a table with electoral results, with this format:
I have merged this table with city shapes and can do a map visualization according to one of the columns.
My problem comes when I want to do filters and queries. I am quite puzzled.
I know how to activate and deactivate layers from an html document, calling (showing and hiding) different fusion tables.
What I want to try now is using a sole fusion table for different ways to show the data. I don't know if this is possible.
For example, possible queries to show on different maps called from a html page:
show only rows with type (column H) 'rural' (filter?)
fill polygons with colours according to the greater value among column B, D and F (if value for party1_2012 is > than party 2 2012 and > than party 3 2012, polygon colour is blue; if party 2 wins, fill is red...)
fill polygons with colours according to the difference between 2 columns (i.e. 2010 and 2012 results)
map combining option 1 (when showing only rural city), apply option 3 (show a colour according the difference between 2 columns)
Inspired by John Keefe's post Making AP Election Data Easy with Fusion Tables, tried to play with data, but no luck. I'm too inexperienced. Is it the way to go generate csv and call them from a webpage? Can I just generate the maps on Fusion Tables and obtain a url to call the queried mapfrom a webpage?
I appreciate suggestions or ways to go.
Thanks in anticipation!
Frans

Resources