I have a field of date-time type. I added this field into a view and formatted the date-time field to show only year. When I switch 'aggregation' on in Views and try to group this field it didn't work as i expect and show all the dates again. I saw the Vies-query and there wasn't any preformatting. It was grouping by dis field only. I want the modify the query to get this fields formatted as I need (years only).
Yes, it seems the aggregation settings work on the query, vs on the results that are output that you've formatted differently.
Here's how you can do the aggregation though:
Select the 'Settings' next to the 'Table' format
Select your date field (that you only show the year on) under the 'Grouping field Nr. 1'
Then just exclude that field from the display, since it'll be output at the top in the group
And here's what the result will be like roughly (for table view... you can try a variety of different ones like lists, etc and style however you like with css). I'm only outputting the title field for mine
Anyway, hope this helps!
Related
There is a date saved in a text field. I'm trying to get documents collection when the field is in a date range using db.FTSearch method. But > and < doesn't work in a text field. Are there any way to convert text field? I'm not familiar with IBM Domino and have tried #TextToTime but doesn't work.
A few ways:
use db.Search instead of db.FTSearch; the syntax is completely different though, plus it is rather slow, but if you have to execute your query once per day or even less, you're fine
write an agent that converts the text date fields into new real date fields, so you can do your FTSearch; make sure you adapt the form used to create the documents, so that it also creates those date fields
use a view, where the first 2 columns contain the date value of your text fields, and sort the view; you'd have to use getDocumentByKey (but I'm not sure this works)
Your date is stored as text, so you need to use #TextToTime().
I.e.,
FIELD #TextToTime(field1) >= [01/01/2018] AND
FIELD #TextToTime(field1) <= [01/19/2018]
I have a list box of dates and a table which has datetime as dimension. The dates from list box is a separate table from that with complete date. I tried connecting them by cutting the datetime into just date (another field) in my select script but did not work. So I thought this should be done on the conditional of datetime dimension but I'm not sure how to do this. How should I be able to show data based on selected dates in Filters?
I would recomend two different approaches, recomending the first one :
On the LOAD script, along side loading the DateTime field, loading the same field again with only the Date part and use than one for filtering. Something like :
LOAD
<... some fields ...>
DateTimeField,
Date(Floor(DateTimeField)) as DateTimeFieldFilter
<... some more fields...>
Add a field selector for you DateTime field, then to Properties, Field dropdown and choose the last option "Expression". On the Expression box enter Date(Floor(DateTimeField)).
My date filter looks like this
but i want it to be a dropdown menu like this
how do i do it? these are the only formats i can select
When creating the filter you must choose discrete dates instead of continuous. then you will have the option to display it as a dropdown menu.
This type of filter looks like this null column to add so drop down is not shown.so update the year values and got the year in show filter and then select the single value drop down. and edit the name in select year to show the drop down menu.
The answer by Littly will work,
One more suggestion is to create a small calculated field called year of Date -
which says -
YEAR(Date)
Put this new field in the filters and click on show quick filters and then you can select drop down and get the desired result.
The reason why this works is that, your field is now either a String column or an Integer column, it will be easily converted to drop down as compared to dates.
I am trying to set up a filter or parameter for different date ranges in Tableau, such as:
Previous Week
Previous 4-Weeks
Previous 8-Weeks
based on the most recent data in the database. Is this possible?
Edit:
I should have been more clear here.
Is it possible to only have these options in the filter and have it based on the maximum date in the database?
Update
Based on your comment and updated question, you can do it as you intend, though it isn't as straight-forward.
NOTE: I did this very quickly and with a random data set, so it will be important for you to test this thoroughly with your data set.
Steps:
Create a parameter control that the users will use to change the selected date range. I created this as a list of strings with values that I can use directly in a calculated (after simple casting):
Create a calculated field that you will use as a filter that references the selection of the parameter control. It tests to see if the difference (in weeks) between the maximum date in the view and the date of any given row is less than the value of the parameter.
Calculation: INT([Date Filter Parameter]) > DATEDIFF("week",ATTR([Date Field]),WINDOW_MAX(MAX([Date Field])))
Place the calculated field in the filter box and set it to True.
You will be able to filter your data like so:
Original Answer
Yup - that is built into Tableau.
Add your date to the filter and select the "Relative Date" option:
You can set the defaults - users can change these later:
Then just "Show Filter":
I have a content type called Event which has a field called field_event_date. The date field can have recurring dates. I'm trying to display a list of events and only show each event one time, however it is showing once for each of the recurring dates.
I've found many posts about this and still can't figure it out.
My view is very simple. It is showing fields and I've tried grouping them by title or nid, but neither changes the number of results. I've also tried checking Distinct (and Pure Distinct) under Query Settings. But nothing changes the number of results returned.
Please let me know if you have any suggestions.
You just need to use under field configuration the "Start date only" and "Show 1 value" as seen in the screenshot below. No need for aggregation and distinct settings.
Apply a filter on the date field
Select the operator: 'Is equal to', and type '0'
When you have a multiple value field, the field has a list or array of values. delta=0 is the first value
https://www.drupal.org/node/1872262#comment-6869736