I am currently working with health data and I wanted to create a visual on google studio that shows that amount of time a player missed due to each injury. However I am only able to show the total sum of the time missed due to an injury if a player suffered two of the same injuries. For example, a player suffered a knee injury in May that resulted in him missing 25 days. He then suffered another knee injury in July that resulted in him missing 15 days. The graph would show that he has missed 40 days due to a knee injury instead of Knee Injury 25 days, Knee Injury2 15 days. I believe the only way I can solve this issue is if I have a unique ID for each Injury. We currently update our google sheets through google forms. So I am wondering if there is a way to create an array formula of some sort that generate a unique ID when there is a value in the Injury column. If the Injury column is blank I want the ID column to be blank as well.
Any suggestions? I've looked into Google Script coding but having trouble with that.
Sorry for the lengthy post.
Thanks
-- Addition --
I am also hoping to have a bar graph show the data above. So for example I have the Player Name Column as a Dimension, the Injury Column as the Breakdown Dimension, and then some kind of calculated field that sums the Time Missed (Days) column by the Injury ID column.
You can use a custom formula like this:
function generate_ids(values) {
values = values.map(row=>row[0])
const ids = values.map(val=>[val?Utilities.getUuid():''])
return ids
}
Use the formula in your sheet as:
=generate_ids(A2:A)
If injury data is stored in column A starting from row 2, or adapt the range reference according to your sheet setup.
Related
I use a IMPORTXML formula to get just one specific value from a website. This value is changing over time. I also have a Table with one entry for each time that value changes and the date on which it did. So say the value changes from 2000 to 2034 and the next day to 2045 my table would look something like this:
Date Value
15.04.2022 2000
15.04.2022 2034
16.04.2022 2045
Now I'm looking for a formula that automates this process and creates a new entry with the corresponding timestamp every time the value changes.
I have automated a lot in the sheet already but I just can't find a way to do this last thing. So any help would be greatly appreciated.
Edit:
This is a very simplified version of my Spreadsheet. Under Current SR is the Value that will update and it's supposed to add another row under the examples.
Edit 2:
I was able to solve the problem, thank you for pointing me in the right direction.
I am trying to transform a report that I have made in sheets into the newest datastudio tool. In my sheet, I have a table where there are several columns that holds data related (this is because each row could have more than one value so I used the "split text into columns" function to represent).
What I have is something similar to:
ID
Component
Component 1
Component 2
101
wood
metal
gold
102
metal
copper
103
wood
gold
metal
In my excel, I have a formula to count the time a certain component is shown by using =COUNTIF(<range>,<string>)
Therefore, with the above formula, I have something similar to:
Component
count
wood
2
metal
3
copper
1
gold
2
I want to be able to build the same in datastudio. Turns out that since the components are divided into columns, I can only use one dimension and the result only shows the count of the first column.
I want to know if there is an easy way to accomplish this. My original data source is like this:
ID
Component
101
wood;metal;gold
102
meta;copper
103
wood;gold;metal
Maybe it's easier to work directly with the previous format but again, using the component in this case only counts for the first occurrence and not across the whole string.
For now, the only solution I can think of is splitting the text into rows instead of columns, but that is not feasible achievable using Google Sheets, or at least not that I am aware of.
Could somebody have an idea of how to accomplish this?
Thanks!
Edit
I am adding here the minimal reproducible example. This is the spreadsheet that I have (example) and the current report I am using so far (built-in sheets):
Now, I want to have the same report (plus more things) using datastudio. This is the report example I have in data studio. As you will see the record count for components is not accurate in DataStudio.
Here is a preliminary answer. I'll polish if we like it and delete it otherwise.
Consider the following sheet:
Range A2:B4 contains my data of interest. Rows 7:10 show the results I think you are looking for. The mechanism for creating this is the value of cell A6 which contains:
=ARRAYFORMULA(QUERY(FLATTEN(SPLIT(B2:B4,";")), "SELECT Col1, COUNT(Col1) WHERE Col1 is not null GROUP BY Col1"))
At the highest level, the formula splits each of the delimited text items into their own cell and then flattens all these cells into one column against which we then run a SQL query against the sheet to group and count them.
In short, I need admins at my work to be able to punch in whether someone is on leave or not into a sheet that informs other sheets to create daily staffing lineups all based in Google Sheets. Right now, I have them deleting whole columns of values and keeping track of what day it is every day. Obviously this is open to error and is a task I'd like to eliminate.
Essentially, I have 7 cell-wide table with the first one being =today() and each one in that row being =today()+1 through =today()+6. What I want to see happen is for the values (underneath) that correspond to that day move (to the left) as the date updates. Furthermore, icing on the cake, I need the new =today()+6 to automatically generate with "no" in each cell under that newly generated date (column H in the below example).
For example, in my submitted sheet, today Karen is OFF in column B. However, in two days time she'll be on VAC which, by that time, should be column B.
I appreciate any help.
Schedule
Here's a link to the sample sheet
Your task can be done if you change the way your managers enter data. If they fill out the data in a table like this
then your master table would look like this
you need to clear the contents in the range B5:H9 and copy the following formula into cell B5
=ArrayFormula(IFNA(VLOOKUP(TRUE&TRUE&$A5:$A,{(Sheet2! $A:$A<=B3)&(Sheet2!$B:$B>=B3)&Sheet2!$C:$C,Sheet2!$D:$D},2,FALSE), "no"))
Then you need to extend this formula to cell B9
I am trying to make a spreadsheet for the Deans at my school to track student detentions. They aren't that great with technology so I want to make it as simple for them to use as possible.
Here is a link to the current layout: https://docs.google.com/spreadsheets/d/1FIW0QAWGStgdUmYU0rWAceWI-YvjM1RIIC_KC2OeWWI/edit#gid=0
It would have a row for every student in the school and use different columns to record when students received a detention and whether or not it has been served yet. I created a formula to check how many unserved detentions each student has so that the deans can easily sort for who needs to serve detention that day.
I want some help creating two scripts:
A button that the deans can click to assign a student a detention. It would need to find the next available empty cell on that row, input the current date, then find the next available empty cell and write "Issued"
A button that the deans can click to mark that student's detentions as served. It would need to find and replace all instances of the word "Issued" on that row with "Served"
Ideal dean workflow:
Issuing a detention - Find the student on the list and click the "Issue" detention button
Running detention - Find the student on the list and click the "Served" button
Meeting with a parent/looking over records later in the year - Find student on the list and scroll horizontally to view dates of all detentions earned that year.
Potential snags:
One of our deans already sheared a spreadsheet trying to sort it. Is there a way I can reduce this risk while still giving him the ability to sort by student name and number of unserved detentions as neccesary?
Here are a few workarounds in lieu of a macro:
To input date > ctrl + semicolon, or command + semicolon on macs. This will enter the current date in the cell.
Use the =countif formula to keep an easily sortable tally on number of detentions a student has been assigned and served
An if statement can let you know that, if the total count assigned vs. total count served do not match, then a student still has a pending detention.
I also recommend keeping a "viewer" tab that your dean uses and the actual area where people are recording the data separate. That way the dean can sort and manipulate your data without actually affecting the original entries.
I'll try and explain this as basically as possible. We have a long list-like table with dates in the first column for each working day then a list on individual piercings we have completed with their respective prices and then daily totals in this format:
Date Piercing Price Daily Total
26/10/13 ear £9.50
navel £30 £39.50
28/10/13 nose £17.50 £17.50
29/10/13 ear £9.50
nipple £25
eyebrow £25 £59.50
etc
etc
As you can see the column which holds the daily totals will have a lot of blank cells in between. So what we have done is made a separate sheet with a list of dates and are hoping to find some form of lookup function which can read the existing "Daily total" column and copy only the cells which have values over in order that they appear so they match up with the right dates like this:
26/10/13 £39.50
28/10/13 £17.50
29/10/13 £59.50
etc
etc
If anyone can lend me as easy way of achieving this I will be most grateful as neither of us are talented with writing our own functions or statement codes.
If you are just looking for a list of dates and daily totals, assuming the daily totals have already been calulated and you never have negative transactions then this should work
SELECT date, MAX(DailyTotal) FROM peircings GROUP BY date;
OR
SELECT date, DailyTotal FROM peircings WHERE DailyTotal!='';
It's hard to know which one might even help you without a better understanding of your database and how you want to use the data.