I have a dataset with Year, school_id, Performance range (let's call it P_range).
Years range from 2019 - 2016
Performance Range from 0-5
Over 2000 unique school_ids
Basically I need to know how each school_id perfomed over the years within performance range.
Example:
YEAR
School_ID
P_Range
2019
1
4
2018
1
5
2017
1
3
2016
1
3
2019
2
1
I would like a fourth column that would look at the dataset and tell me in which year did its performance alter
2019-2018 this school decreased the range
2018-2017 this school increased the range
2017-2016 this school maintained the range
2016 would not compare to anything which is "First evaluation"
So at any given time, when we look at the results of 2019 we would see a sum of results being compared to 2018 and so on.
We need to know at a yearly rate, how many "maintained", "decreased" "increased" or "First evaluation"
If it were on excel this would be the formula:
=IF(B2=B3;IF(C2>C3;"INCREASED";IF(C2=C3;"MAINTANED";"DECREASED"));IF(B2<>B3;"1ST EVALUATION"))
Related
Hi everybody I am trying to query an already formatted google sheets, I am able to filter some of those data (I used =query(x,select * where ... )). The output I get is the following:
may
may
june
june
july
july
july
planned
name
1
0
1
1
2
3
1
Now I want to refer to all the numbers under may (or june or july) in order to do some operation. I can' t just select the value I want because I need to automate it.
How can I get all the columns containing a specific marker(in my case the name of the month)? If it is not possible can you suggest me a different way to do that ? (I am not very experienced with google sheets or excel)
Since query can't select rows, you'd transpose it first and then select the columns you want and then retranspose it back, if needed:
Input:
may
may
june
june
july
july
july
planned
name
1
0
1
1
2
3
1
Formula(select columns >0):
=QUERY(TRANSPOSE(A27:I28),"Select * where Col2>0")
Output:
planned name
may
1
june
1
june
1
july
2
july
3
july
1
I have the year a car was purchased in column A. For example, 2015. I'm trying to calculate the age of the vehicle comparing the year provided in column A to TODAY() in an arrayformula, like this...
={"Vehicle Age";arrayformula(if(A2:A="",,(datedif(A2:A,today(),"Y"))))}
For some reason, it gives me the number 115 as the result for every cell where a year has been specified. Any idea why? I can't seem to find an answer on this anywhere on the internets.
Thanks for your help!
You are mixing apples and oranges here, so to speak.
Internally, Google Sheets sees all full dates as a number of days from an origin point of December 31, 1899. As such, the year 2015 on its own, in a comparison with a full date will be seen as two-thousand-fifteen days since December 31, 1899 (or July 7, 1905 — which was 115 some-odd years ago, as would be the case with any relatively recent year, because they'll all be interpreted in their raw form by Sheets as a cluster of days from late June to early July of 1905).
Instead, you want to compare the years only, which will mean extracting the year from TODAY(), since A2:A are already year-only numbers:
={"Vehicle Age";arrayformula(if(A2:A="",,year(TODAY())-A2:A))}
However, since any year's car models are actually released the year before, you may want to add a year to your formula:
={"Vehicle Age";arrayformula(if(A2:A="",,year((TODAY())-A2:A)+1))}
Of course, you could also have turned your A2:A years into real dates (e.g., January 1 of each year listed) and then used datedif as well:
={"Vehicle Age";arrayformula(if(A2:A="",,datedif(DATE(A2:A,1,1),today(),"Y")))}
... or with that extra year added ...
={"Vehicle Age";arrayformula(if(A2:A="",,datedif(DATE(A2:A,1,1),today(),"Y")+1))}
={"Vehicle Age";arrayformula(if(A2:A="",,datedif(DATE(A2:A,1,1),today(),"Y")))}
Not working
I just want to run a simple weekly traffic report with the Google Analytics Sheets add on. It does work fine, but I can't seem to figure out how to sort the weeks in chronological order with the jump from 2019 to 2020.
This is how it looks like
Order of the weeks
Does anybody know what Order I need to enter to have the order from week 38 - 53 and then continue with 1,2...?
Include the year as dimension and order by year and by week, like this:
year week
2019 38
2019 39
2019 40
...
2020 1
2020 2
2020 3
For multi year weekly analysis, it's better to just use the corresponding Mondays for any date for your grouping/summing/analysis than it is to use "Week Numbers"
Those mondays can be obtained by using this arrayformula, assuming your dates were in column A (A2:A)
=ARRAYFORMULA(IF(A2:A="",,FLOOR(A2:A+5,7)-5))
I'm working in Google Spreadsheets trying to compare two years of data for each month.
year jan feb mar apr may etc
2012 4 3 5 6 4 3
2013 2 4 5
I want to be able to compare the data I have so far because if I don't have enough data, then the comparison will not be accurate until all of the months are complete.
How do I compare 2013's jan,feb,march to 2012's jan,feb,march and have it dynamically adjust?
For instance, if I input april, have it compare jan-april of 2012 as well.
Please try:
=IF(ISBLANK(B3),"",SUM($B3:B3)/SUM($B2:B2)-1)
in B4 and copy across to suit.
Yes, in this case the formula works (or not!) the same in Excel and Google Docs.
I have to calculate / present number of team trough years in olap cube
My team fact is structured this way:
TeamId DateFrom DateTo (FactTeams)
1 2012 2015
2 2012 2015
3 2012 2015
4 2015 2018
1 2018 2019
Cube must be able to answer, for example, how many teams have been active in year 2012 (3 teams)
I have prepared another helper fact table that contains all combination of teams id and their dates.
TeamId DateRange (FactTeamDates)
1 2012
1 2013
1 2014
1 2015
1 2018
1 2019
2 2012
2 2013
2 2014
2 2015
...and so on ...
I have created two facts one FactTeams and another FactTeamDates. I have also standard date dimension. Here is my data source view:
https://www.dropbox.com/s/5d2gzumxv5fejdq/teams.jpg
FactTeams.TeamId is linked to FactTeamDates.TeamId and FactTeamDates.DateRange is linked to DimDates.DateKey.
I have measure “Team Number” that is distinct count of FactTeams on column TeamId.
My desired MDX query output for measure Team Number on COLUMNS and Years ON ROWS is:
Team Number
Year 2012 3
Year 2013 3
Year 2014 3
Year 2015 4
My question: How to organize my fact and set dimension usage in my cube to get desired output?
SQL query that produce desired output:
SELECT
d.CalendarYear
,COUNT(DISTINCT TeamId)
FROM FactTeams zt
INNER JOIN FactTeamsDates td ON zt.TeamId = td.TeamId
INNER JOIN DimDates d ON d.DateKey = td.DateRange
GROUP BY d.CalendarYear ORDER BY 1
Note that I know that I can create data view based on the above sql query (with joins) and then have one joined fact table, but I want to have some kind of join between my cubes dimensions and facts – to have joins in cube (olap) level only, not in sql (database, or cube data view)
Thanks in advance
You can create a distinct count measure and this should solve your problem