Drupal 8 contextual filter for date - date

does anybody know how to implement the view with contextual filter on date/time value? I have a content type Event with date field within it and need to somehow filter items within specific month. Not sure if it can even be done without special programming and if so, whether via that contextual filter (like node/) or maybe via exposed filter with list of months so user can filter items by himself??
Thanks
TC

There exists the contextual range filter module.
https://www.drupal.org/project/contextual_range_filter
To the time I am writing no Drupal 8 version is shown on the module page, but there are some. Have a look in the release section "View all releases". There you can filter the API version "8.x".
You can have a look into the README.txt for all the possibilities to query.
http://cgit.drupalcode.org/contextual_range_filter/plain/README.txt?id=refs/heads/8.x-1.x
A simpler solution could be to use the build in function in views
You can add special fields in the contextual filters section
They are called:
Created year
Created year + month
Created week
Created month
Created day
Created date

Related

Get full date range of linked field in tableau

Gif of problem
I am currently working on a dashboard in tableau, which shows the count of New-User-Signups and Interactions side-by-side given different date windows. The first New-User-Signup happened before the first Interaction, and the last Interaction happened after the last User Signup.
In order to choose a date window, I linked the date fields in both data sources, and made a date filter, which I applied to all worksheets using related data sources.
However, depending on which "date" field I choose, (from the User Signup table or the Interaction table), the "All Dates" option of the date filter only goes from start to end of that data source's date range.
No matter what I try, I exclude some entries in either one graph or the other. How can I make the "All Dates" filter go from the minimum first date between both data sources, to the maximum last date between the two data sources?
I run into this issue a lot with the data that I use. The problem is that the filter will only be able to contain dates that are in the dataset it is created off of, even if you link the data sources. When I run into this issue, I use parameters instead.
You can find instructions here:
https://kb.tableau.com/articles/howto/creating-a-filter-for-start-and-end-dates-parameters

Query on Tableau Dashboard

I am a new to Tableau and having some issues with it.I am Using a parameter to filter month data across Sheets connected to different Data Sources.
I want to Filter Current Month Data Automatically when the dashboard starts.
Can anyone guide me on how to do it.
Thanks in Advance.
T
Introduced in version 10.3 is a feature called Latest date preset. The release notes say "Start with up-to-date data. Set filters to display latest date values automatically, as soon as your workbook opens." Create a filter that spans applies across the data sources and use this new setting. The setting is in the filter dialog.
See https://www.tableau.com/new-features/10.3#tab-analytics-2
The critical aspect of your question is that you are filtering multiple data sources using a parameter. Given that, the most straightforward approach is to define a boolean calculated field in each data source, called say Within_Date_Range.
Each of those calculated fields should compare the appropriate Date field in that data source to the selected parameter value and return true or false to indicate whether the current record should be included in the query. (Parameters are scoped to the workbook and visible from all data sources)
Place the [Within_Date_Range] field for data source X on the filter shelf for the worksheets that use that data source X. Check the true box of course.
Now when you change the parameter, all the worksheets filter accordingly.
Alternatively, you can abandon the use of a parameter. Define relationships between your data sources using the corresponding Date fields (under the data menu). Show a filter control for the date field for one of the worksheets and set the scope to "related data sources"
Hope this helps!
Create a calculated field Date_Filter as
lookup(min([Your_Date_Field]),0)
Drag this to 'Filter'; select 'relative date' option and choose last 1
month (because you wanted to show just the current month data by default).
Right click this filter and select "Apply to selected worksheet" and
choose sheets in which you want this filter to be applied on the
dashboard.Viola!
With this solution you can very well see current month's data by default and can go back to as many time periods you want.

Set the latest date value to the Quick Filter in TABLEAU

There is a live worksheet called Person with columns - Names & Birthdays. Need to create a quick filter with a default value pointing to the latest birthday.
For example: If there are 3 Records as follows,
Names Birthdays
A 8/9/1993
S 6/5/1994
Z 8/15/2000
The filter should hold the default value 8/15/2000 in it with other values unchecked in the drop down list.
I believe I see what you are asking. When you add your filter click the little drop down arrow in the filter --> edit filter-->select the tab labeled "Top"--> by field radio button==>Top from the first drop down-->enter 1 in the next field which will say by after it-->select birthday from the next drop down--then maximum. This will change the view to show only the most recent birthdate. Hope this helps.
Tableau currently doesn't give you dynamic control over quick filter defaults. For dates. They generally start out with the settings that were published.
Here are a few easy suggestions that are similar to, but not exactly, what you want. At the end, there is a way to do exactly what you want at the cost of more effort.
For continuous date fields, you can set the filter to show Relative Dates and the filter allows the user to easily set a range of dates showing the last N days, weeks or months relative to an anchor date. The anchor date defaults to the current date.
For discrete date fields, you can display a top filter as tia97 recommended, and show an integer valued parameter control to allow the user to pick N to see the latest N birthdays. (i.e. the N youngest people)
You could try other variations using parameters, calculated fields and quick filters, but it might be simpler to just show the list of birthdates and let people choose.
Finally, if you are publishing this workbook to Tableau Server, you can use the Javascript API to control the filtering user experience yourself. You can embed the Tableau visualization in a web page, surrounded by custom HTML, CSS and Javascript that you define. Build whatever controls you want for user interaction, and then send JavaScript commands to Tableau to direct the filter actions. More effort, but you get a lot more control over the UX.
Generally, I'd use the builtin features in Tableau Desktop as far as they go to get most of your desired UX quickly and easily, and then save the JavaScript API work for final polish on only your most public visualizations that really need it.

Adding a date view to Objects in Rails

how do you view objects by day with rails?
I have an advertisers MVC and am currently listing advertisers created. I'd like to generate a view of advertisers for particular days - so you can choose the day on a calendar icon and see the advertisers added on that specific day.
I appreciate any help you guys can give - or pointing me in the right direction...
If you want to just order by date, that's a relatively simple solution (mock code obviously since I don't have access to your app, change variables to match your reality). In your controller action for index:
#advertisers = Advertiser.order(:date)
where 'date' would be your column name. You can add ASC or DESC to control ascending or descending.
#advertisers = Advertiser.order(date: :asc)
More on this here:
http://guides.rubyonrails.org/active_record_querying.html#ordering
In the specific case above, it sounds like you only want to show those that MATCH the particular date in question. I would set this up as an AJAX request when you click on the date in the view file. You could pass this to a Advertiser.find_by date: (or find_by_date in pre v4) kind of approach.
Advertiser.find_by date: '2013-11-13'
http://guides.rubyonrails.org/active_record_querying.html#retrieving-a-single-object
Something along those lines should get you on the right path.

Service anniversaries today with SharePoint using calculated fields and filters

I need to create a view that show employees that have their Service anniversary today.
I am familiar with the problems with using [Today] in calculated fields but still thought that this was a straight forward thing to do.
I have a list with a [Hire Date] field.
In that list I have created a calculated field [Hire Date - mmdd] with the formula =TEXT([Hire Date],"mmdd").
With this someone hired 15 years ago today will for instance get the value 1115
This works fine. So far so good.
Next step is of course to create a view in order to list employees with Service Anniversary today - knowing that [Today] is allowed in filters.
I create a view selecting all employees with [Hire Date - mmdd] is equal to TEXT([Today],"mmdd")
But it does not work !!!
Why does this not work when [Today] is otherwise working fine in filters.
BTW: This is SharePoint 2007
It doesn't work because you can't put anything other than very basic calculations in filters.
The filter is looking for records that have
[Hire Date - mmdd] = "TEXT[Today],'mmdd'"
without doing the text calculation turning TODAY[xxxxx] into "1115"