Any way to group Sheets source data in chunks? - google-sheets

I have some data that was set up poorly coming from Firebase Realtime Database. I will be updating the way the data is stored to make it easier to work with in the future, but for the data that exists I'd like to find a way to make it readable for a report. The data is coming in from the Realtime Database API into Google sheets, and it looks like this right now:
10/01/2020 abc123 Email | 10/01/2020 abc123 Status | 10/01/2020 abc123 Time | 10/01/2020 def456 Email | 10/01/2020 def456 Status | 10/01/2020 def456 Time
fake#email.com Clocking In 12:10:50 fake#email.com --------Clocking Out -----------15:16:53 GMT-0400 (EDT)
I did my best to get format that like a table, hopefully it gets the point across (the hyphens were necessary to keep formatting).
Anyway, the object with headers like "Date random letters and numbers for id Field". Is there any way to group it more so it's like:
ID | Email | Status | Time
Date abc123 | fake#email.com | Clocking In | 12:10:50
Date def456 | fake#email.com | Clocking Out | 15:16:53
I've got hundreds of these, so I'm hoping to find a way to automate it and make this data readable for other people

On a new tab called MK.Help in the sample sheet you provided, This formula will grab ONLY every 3rd column and transposes it to show the email addresses.
=TRANSPOSE(FILTER(Sheet1!2:2,MOD(COLUMN(Sheet1!2:2),3)=1))
Similarly, this one will grab every third, but a starting in a different place to grab the In/Out.
=TRANSPOSE(FILTER(Sheet1!2:2,MOD(COLUMN(Sheet1!2:2),3)=2))
This one will do the same for the Times, but it first Adds the date to it so that you can get a full timestamp. It uses some text manipulation functions, specifically LEFT() to only grab the data from each row necessary to construct a proper timestamp
=TRANSPOSE(FILTER(IFERROR(1/(1/(LEFT(Sheet1!1:1,16)&LEFT(Sheet1!2:2,8)))),MOD(COLUMN(Sheet1!2:2),3)=0))

Related

TABLEAU - Joins on the fly on raw data

I have been trying to perform joins on the fly in Tableau to perform some online computation - with no luck so far.
I wonder if any of you is aware of a way to achieve this?
I have a typical transactions dataset ("MYDATA"), with user ID (user's identifier), transaction date (when the transaction occurred), and purchases (the transactions). Something like:
ID TRANSACTION DATE PURCHASES
123 20/03/2020 1
123 22/03/2020 4
234 20/03/2020 10
234 22/03/2020 1
345 22/03/2020 5
What I would like to achieve is to add to it a variable with the SUM of PURCHASES by ID (say field "PURCHASES PER ID").
Then, critically, I'd like to make this computation update dynamically as I filter by different values in TRANSACTION DATE from the UI.
Ultimately I'd like to create a chart displaying the count of users (field "ID") in each value of the field "PURCHASES PER ID" (like bins), where "PURCHASES PER ID" is re-computed according to the date ranges selected in the worksheet.
Something like:
Case 1 : FILTER Transaction date = 20/03/2020 AND 22/03/2020
|---------------------|------------------|
| count OF ID | SUM of PURCHASES |
|---------------------|------------------|
| 2 | 5 |
|---------------------|------------------|
| 1 | 11 |
|---------------------|------------------|
Case 2 : FILTER Transaction date = 20/03/2020
|---------------------|------------------|
| count OF ID | SUM of PURCHASES |
|---------------------|------------------|
| 1 | 1 |
|---------------------|------------------|
| 1 | 10 |
|---------------------|------------------|
I'd expect this to be doable in Tableau, as I'm able to it with a much more simple (and cheaper) tool like Google Data Studio.
In Data Studio I'd simply do a join between "MYDATA" and the sum of PURCHASES grouped by ID - using ID as KEY. Then, I'd able to use that calculated sum of purchases as a dimension, and count the IDs in it.
Are you aware of a way to achieve the same in Tableau?
Many thanks
Think I got it.
My solution was:
Columns: ({FIXED [ID]: SUM([PURCHASES])})
Rows: CNTD(ID)
Filters: Add TRANSACTION DATE to Context
This allows me to achieve the view I wanted to.

Is it possible to aggregate expenses per category in google spreadsheets

I am trying to track my expenses manually. I looked for already built options and I did not find anyone I knew how to use or that it covered what I want to do.
What I am doing is basically manually write down what appears in my bank, with the intention of categorizing the expenses myself, since as I said, I did not find a better way to do it.
So it looks like this:
Cinema | 11.95
Going out (restaurant1) | 26.55
Netflix | 13.95
Weekly purchases | 72.66
Going out | 9
Bill (type) | 29.16
Rent month | 650
Going out | 26.55
Bill (type2) | 66.45
Compra semanal | 81.09
Bill (type3) | 21.1
( "|" is used as if it were two different cells) And what I would like now is to take the generic name that I gave the cathegory (without the parenthesis, I am using those for myself, so I can track where was the money spent, more specifically), and how much was spent.
In programming I would do this with a regex for the left cell, and aggregating by name, and then plotting the data somehow. I am unsure if this is even possible, maybe I should use Excel but Drive has the cloud advantage so I would like some help as to where to start, I do not need anything too fancy, a new column with the category and the total spent would work wonders for me, but I have not found an easy way of doing it (and I doubt I am doing something so complex, so I assume I am thinking this the wrong way). Best case scenario, I manage to plot it all so it is more visual, or I can have several columns plotted against each other (I have different columns for shared expenses, personal expenses, and so on).
If you can put the category (e.g. Bill) in a separate column from your details (e.g. type 1) then the Pivot Table feature is exactly what you need.
Start with something like this (the heading on each column is important):
Category | Details | Amount
Cinema | | 11.95
Going out | restaurant 1 | 26.55
Netflix | | 13.95
Weekly purchases | | 72.66
Going out | | 9
Bill | type | 29.16
Rent month | | 650
Going out | | 26.55
Bill | type2 | 66.45
Compra semanal | | 81.09
Bill | type3 | 21.1
Then click Data, Pivot Table. Under Rows, click Add and choose Category. Under Values, click Add and choose Amount. You should see a table like this:
Category | SUM of Amount
Bill| 116.71
Cinema | 11.95
Compra semanal | 81.09
Going out | 62.1
Netflix | 13.95
Rent month | 650
Weekly purchases | 72.66
Grand Total | 1008.46
Any unique value in the Category column creates a new row in the pivot table.
Further Details: https://support.google.com/docs/answer/1272900
=ARRAYFORMULA(QUERY({REGEXREPLACE(TRIM(A:A)," \(.*\)",),B:B},"Select Col1,sum(Col2) where Col1 is not null group by Col1"))

Is it possible to lock rows and columns in Google Spread Sheet?

In one of our project website, we are about to use Google spread sheet for our clients to enter some information and do some spread sheet work. So using Google APIs We can create spread sheet on our website and allow users to enter details in it. But my question is that is it possible to lock rows and columns so users can only enter data in the field they are allowed to modify?
For example,
--------------------------
| Car Rent | |
| Total Gas | |
| Insurance | |
| Commission | 1% |
--------------------------
Lets say this is our basic template for spread sheet for all of our users. The can enter Car rent, total gas and insurance value but they are not allowed to modify anything else, including row headers or any other empty cell outside this box. So is there anyway to lock it for users in spread sheet? Can anyone point me to guide or api details?
Thanks

Combine 2 queries (different columns from 2 different sheets) and filter based on matching results

As usual, I have set a goal, way beyond my skills...
I need to get data from 2 sheets, One has a lot more entries than the other (a master list I guess you could say). Any entry in the smaller sheet will always have a matching entry in the Master, but not necessarily the other way round.
I have written what I need in pseudo query syntax, but I need help getting this to work...
QUERY the 'Catalog' sheet and get TITLE, SUBTITLE, STATUS, TITLE-ID WHERE the STATUS does NOT have the word 'Retired' in it.
Then Query 'Report_Dec 2017' and get UNITS, USD, GPB, EUR WHERE TITLE-ID from 'Report_Dec 2017' Matches TITLE-ID from 'Catalog'
Catalog (master)
| TITLE | SUBTITLE | STATUS | TITLE-ID |
Report_Nov_2017
| UNITS | USD | GPB | EUR | (has TITLE-ID also, but don't need this twice)
Final result should look like this:
| TITLE | SUBTITLE | STATUS | TITLE-ID | UNITS | USD | GPB | EUR |
The end result should only ever have a max number of entries equal to that of from 'Report_Nov 2017', So the Catalog might have 100 total entries but since only 20 units were sold in November, then the result will only show 20
First of all is that possible? And secondly, if it is, can someone point me in the right direction?
EDIT UPDATE
I have made some progress with this, but I am stuck on a strange issue...
This is my google sheet:https://docs.google.com/spreadsheets/d/10uXJVilUqAnSE_ZPlA6VKMBl0DCFRt_WqzYYl-c4Syc/edit?usp=sharing
This is my current formula:
=ArrayFormula(query({to_text(Catalog!B:J),to_text('Report_Nov 2017'!A:J)},"SELECT Col1,Col3,Col4,Col9,Col16,Col17,Col18,Col19 where Col4 != 'Retired' and Col15 MATCHES '"&textjoin("|", TRUE, Catalog!J2:J)&"'",1))
I am getting a result where the entries returned from Catalog are not matching the entries returned from ReportNov2017 - It just seems to be grabbing the first 25 results from Catalog instead of checking to see if the TITLE ID matches in ReportNov2017 - Any Ideas where Im going wrong?
I suggest you split the task into smaller tasks:
add some columns to the report sheet: | TITLE | SUBTITLE | STATUS |. Get their values from Catalog (master). You may try vlookup arrayformula to automate this. See the article.
Then use simple query formula to get the rest.

Writing BDD feature files shorter and cleaner

I have s lot of scenarios that are identical, they only differs by data which are passed to them.
This is example:
Feature: Linking facts from a report into Excel document
In order to link facts to an Excel document
As an user having access to report
I want to click on fact's value in the report
Scenario: Any uri item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell C2
And I click on the value in 2 column of the row entitled any uri item
Then Excel cell C2 should contain value some internet address
Scenario: Base64 binary item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell F3
And I click on the value in 2 column of the row entitled base64 binary item
Then Excel cell F3 should contain value asdf
Scenario: Boolean item
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell J3
And I click on the value in 2 column of the row entitled boolean item
Then Excel cell J3 should contain value true
I would like to shorten this to look something like following:
before scenario:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
scenario:
When I click on excel cell XX
And I click on the value in YY column of the row entitled ZZ
Then Excel cell YY should contain value WW
and than some table data, like:
| XX | YY | ZZ | WW |
| C2 | 2 | any uri item | some internet address |
| F3 | 2 | base64 binary item | asdf |
| J3 | 2 | boolean item | true |
I found an solution.
There is an scenario outline with this ability.
Scenario Outline: display label in selected language
Given I am logged as <username> with <password>
And I have clicked on <button> button
Then result should be some result
Examples:
| username | password | button |
| john | doe | first |
| foo | bar | second |
You could use Scenario Outline instead of Scenario. Your example would look something like this:
Scenario Outline:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
When I click on excel cell '<Cell>'
And I click on the value in '<Column>' column of the row entitled '<Row>'
Then Excel cell '<Cell>' should contain value '<CellValue>'
Examples:
| Cell | Column | Row | CellValue |
| C2 | 2 | any uri item | some internet address |
| F3 | 2 | base64 binary item | asdf |
| J3 | 2 | boolean item | true |
This is a very interesting question and I have spent some time researching what I call "data driven Specifications". This is partly inspired by the "row-test" or "data-driven-test" features that many common test frameworks offer.
Not that I use the terms "Scenario" and "Specification" synonmous, however I prefer the latter.
Similar to a normal unit test, a BDD specification is composed of three parts. A common template used is the "Given X When Y Then Z" formula. What you have discovered is that for a lot of your specifications the "X" part stays the same. Whenever I encounter such a situation, I try to create a Fixture class to abstract this. For example, one of those classes might be a LoggedInUserFixture which sets up a logged in user and makes it available to the test.
Very often, you'll find the need to compose this fixture with other fixtures, to create the setting for your specification. For example you may need a LoggedInUserFixture and a UserWithSampleProjectSelected for a single Specification. The easiest way to do this is to create another fixture class that will setup its child fixtures and makes them individually available to your test.
I am still resisting the urge to extract a common pattern for composing fixtures and make a test framework support this.
To come back to the suggestion to use data to drive specifications, I think it is a valid and useful patterns, I usually make the data drive my fixture creation (the fixture has an appropriate constructor for data injection then). See SubSpec's Theorie feature for details.
This answer is 8 years too late, but Gherkin has a way of eliminating this duplication. It's called the Scenario Background:
Feature: ...
In order to ...
As a ...
I want to ...
Background:
Given common step 1
And common step 2
Scenario: A
When ...
Then ...
Scenario: B
When ...
Then ...
More specifically applied to your situation:
Feature: Linking facts from a report into Excel document
In order to link facts to an Excel document
As an user having access to report
I want to click on fact's value in the report
Background:
Given I am logged as admin with admin
And I have selected Sample Project
And I have chosen to view report presentation view containing data from factcollection1 and all periods and all clients
Scenario: Any uri item
When I click on excel cell C2
And I click on the value in 2 column of the row entitled any uri item
Then Excel cell C2 should contain value some internet address
Scenario: Base64 binary item
When I click on excel cell F3
And I click on the value in 2 column of the row entitled base64 binary item
Then Excel cell F3 should contain value asdf
Scenario: Boolean item
When I click on excel cell J3
And I click on the value in 2 column of the row entitled boolean item
Then Excel cell J3 should contain value true
The three common Given steps are moved into the Background, and then each of your scenarios start out with a When.
Nice and tidy.
The reason this is preferable to a scenario outline is because you are dealing with parsing multiple kinds of data. Presumably there is some parsing logic behind the scenes, and parsing each data type could break in different ways during regression testing. Each test should only have one reason to fail, and your original scenarios properly capture that.

Resources