How to change import range within expression from cell - filter

I want to have my expression change based on the value in A1. In A1 the user will put the Month Year (July 2019) I want to know if it is possible to change this "July 2019!A1:U23" value based on that data. So next month in a1 if the user inputs August 2019 it will update the expression with that date. A1 corresponds to the sheet name
IE: A1 = August 2019 "August 2019!A1:U23"
=filter(importrange("SheetID","July 2019!A1:U23"),importrange("SheetID","July 2019!F1:F23")=".DM1")

yes, it is possible. all you need to do is:
=FILTER(IMPORTRANGE("SheetID", A1&"!A1:U23"),
IMPORTRANGE("SheetID", A1&"!F1:F23")=".DM1")

Related

Two Date Filters in Google Data Studio

I have a Google Sheet as the source data for a table in Google Data Studio. My table includes fields for "Sign Up Date" and "Cancellation Date".
I want to be able to filter so that I can choose a date range for "Sign Up Date" and a different date range for "Cancellation Date". For example, show me all records where the "Sign Up Date" is between Jan 1 to Jan 31, 2021, and where "Cancellation Date" is between Aug 1 to Aug 31, 2021.
As far as I can see you can only choose one Data Range Dimension per table, and any date filter you add is tied to that date field.
Is there any way I can have separate date filters for each of my date fields?
Two Range Slider Community Visualisations could be used (one for each of the date fields, Sign Up Date and Cancellation Date).
1) Accessing the Range Slider:
Click the Community Visualisations and components icon on the toolbar:
Select +Explore more to view all:
Choose the Range Slider chart from the displayed Community Gallery:
Click "Allow" to grant access to the respective Community Visualisation:
2) Using the Range Slider:
2.1) Sign Up Date Range Slider
Create both Range Sliders below and adjust the date range as required, in this case 01 Jan 2021 to 31 Jan 2021 for Sign Up Date and 01 Aug 2021 to 31 Aug 2021 for Cancellation Date:
Column to filter on: Sign Up Date
Cross-filtering: Select (☑) (this option makes sure the Range Slider also affects other charts)
2.2) Cancellation Date Range Slider
Column to filter on: Cancellation Date
Cross-filtering: Select (☑) (this option makes sure the Range Slider also affects other charts)
Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:
It looks like there is not.
What you can do it make different versions of advanced filters and use the "Between" function to compare numeric values. So you have to convert dates to some kind of numeric value first. Here is an example for this:
Data Studio Date Range Filter on hour, minute level

How to display Week as number in AWS QuickSight?

I need to display Week as number in AWS QuickSight. There is no WEEK function under extract. truncDate has WK, but this function does not result as Week_number: truncDate('WK',{date}). Any ideas?
In the field wells click the dropdown for your date field, mouse over Format and select 'More formatting options'. On the left panel in the Custom dropdown type 'w'.
Create a calculated field
dateDiff(truncDate('YYYY', mydate), mydate, 'WK')
As explained before, you can do what you are looking for by going to the Field Wells -> Datetime field (X or Y axis) -> Format -> More formatting Options -> Custom.
You can use W or w, the first will give you the week number corresponding to the current week, while the latter may offset you by a week. For instance, using an aggregation by DAY, the date of 14-Jun-2021 gives me Week 25 when I use custom w and Week 24 when I choose W.
If you want year and week combination then you can use customer format option and type 'Yw' (this will return 202121 - 2021 year and 21 week).

Sorting by Date After Mult-IMPORTRANGE and QUERY

Have a Google Sheet that I'm trying to build. It uses IFTTT to pull articles people read into a individual, and then an aggregate spreadsheet.
In terms of specs, it needs to:
Pull in data from multiple sheets.
The first column in each source sheet is a date column. Some are formulas (to remove extraneous data from another date column), and some are hard-coded. This may differ sheet to sheet, but is constant per sheet.
Once imported into the aggregate sheet, I need to sort by date.
Problem
I'm a query/importrange newbie, and I'm currently stuck on the sorting by date.
Current URL
https://docs.google.com/spreadsheets/d/1GLGYvApJgRheg7rgzoB8rFyTUgkRpZ2O8eKVE4bZyo4/edit?usp=sharing
When I order by Col1, I can't honestly tell how it is sorting, the end result is:
March 7, 2017
February 15, 2007
February 28, 2017
March 7, 2017
March 8, 2017
November 9, 2010
If you inspect the cells, the first March 7, 2017 is situated where the formula resides, which does not seem to move no matter how I sort. If you look at the sort order without that cell, it seems to be sorting alphabetically.
So it comes down to two main questions:
-What am I doing wrong that is making it so the order by is not including the first row.
Edit: This is now fixed
-How do I get it to recognize that the contents of the sorting column is a date?
Thanks ahead of time -
J.
Your formula seems to have a few problems.
importrange should take key not url. But it seems that it works anyway...
Pulled sheets have no header, so the 3rd parameter of query should be -1 or omitted, not 1.
If Col1 is a valid date, <> '' should not work. It should be is not null.
But it turns out that your pulled sheets' dates are not yyyy-mm-dd format so they weren't recognized as dates by query.
Thus, more valid formula should be like this:
=query({importrange("...", "Sheet1!A:E");importrange("...", "Sheet1!A:E")},
"select * where Col1 is not null order by Col1 asc",
-1)
And you should format dates(column A) on your pulled sheets to yyyy-mm-dd. Check my working sample aggregator and pulled sheet one and two.

COUNTIFS using separate workheet and a date range in Excel for Mac

I'm using Excel for Mac and I'm trying to COUNTIFS a date range using a separate worksheet. The name of the worksheet is "KIDS" and the column in that worksheet is R. Where am I going wrong?
=COUNTIFS(KIDS!R:R, ">01/07/2015", KIDS!R:R, "<31/07/2015")
I think it was due to Excel interpretation of the date literal. It may see 01/07/2015 as a string, July 1 2015 or Jan 7, 2015.
This works for me:
=COUNTIFS(KIDS!R:R,">2015-07-01",KIDS!R:R,"<2015-07-31")
(this is called the canonical format by the way: yyyy-mm-dd)
Set the "format" of the values in R column to "Date" and then run the following query:
=COUNTIFS(KIDS!R2:R8,">7/1/2015",KIDS!R2:R8,"<7/7/2015")
Note:
R2:R8 specify the cell range in column R.
Date i.e 7/1/2015 is in the same format as of the data in column R.

Need to set up a customised date range validator in Ruby On Rails

I have the following model which corresponds to teh following table:
PriceAvailability
ID| PRODUCT_ID| VALID_FROM|VALID_TO|PRICE
Basically the table stores prices of a particular product between a specific range of dates. Like a product may cost 10 dollars between 1st Jan 2012 to 3rd May2012 and 12 DOllars from 3rd of May to end of June etc. Thing is that I need to set up a validator that:
Ensures that each record has a date range that doesnt overlap or conflict with another date range for that specific product, i.e you canot have two rows that have a date ranges 1st of Jan 2012 - 1st March 2012 and 1st of Feb 2012 to 1st April 2012 respectively for product ID 1.
I got the idea of setting up validators and even set up a simple validator for the start date however I'm stuck with implemnting this kind of check. How can I do it?
let me know if this works for you:
validate :ensure_unique_date_ranges
def ensure_unique_date_ranges
date_ranges = (products.price_availabilities - [self]).map{ |pa| (pa.valid_from.to_i..pa.valid_to.to_i) }
self.errors[:base] << 'date range is invalid' if date_ranges.detect{ |dr| (dr.to_a & (valid_from.to_i..valid_to.to_i).to_a).empty? }
end
One thing to watch out for is date.to_i. If ranges are big then performance might go down. Try and see if it's acceptable.

Resources