RSA Archer - I would like to create a calculated field based on a date field that is in the format dd/mm/yy. The calculated field needs to show both the Quarter and Year of the date field. Is this possible?
I have tried using Quarter([date field]) and YEAR([Date field]) - is there a way to combine both to get an answer ie 1 2016
QUARTER([Date Field]) &" "& YEAR([Date Field])
OR
CONCATENATE(QUARTER([Date Field])," ",YEAR([Date Field]))
This will give you the result in the format you need.
Hope this helps!
Related
I got a table with a huge list of equipment booking details. I wrote a SQL Query to display the desired result that I wanted: A type of the equipment with time overlapping of booking.
So I check for the time overlapping by duplicating my table in order for it to check against each other.
The result I gotten are kind of repetitive?
For instance,
May CLASHES Claire
May CLASHES Sherene
Claire CLASHES May
Claire CLASHES Sherene
Sherene CLASHES May
Those in bold are repetitive.
How can I modify my SQL query in order to resolve the issue?
Please kindly advise. Thank you!
SELECT DISTINCT *
FROM 2015, 2015 AS 2015_1
WHERE ([2015].Equipment Like '*Video cam*' Or [2015].Equipment Like '*video recorder*' Or [2015].Equipment Like '*camcorder*')
AND ([2015_1].Equipment Like '*Video cam*' Or [2015_1].Equipment Like '*video recorder*' Or [2015_1].Equipment Like '*camcorder*')
AND ([2015].[Loaned By]<>[2015_1].[Loaned By])
AND ([2015_1].[Start Time]<=[2015].[End Time])
AND ([2015_1].[End Time] Is Null Or [2015_1].[End Time]>=[2015].[Start Time]);
EDIT
My table is called 2015.
The variables are (Field Name - Data Type):
ID - Number
Loaned By - Text
Equipment - Text
Start Date - Date/Time
Start Time - Date/Time
End Date - Date/Time
End Time - Date/Time
Durations (hours) - Number
You can add the following condition:
[2015].EquipmentType < [2015_1].EquipmentType
This will order them alphabetically.
Your question doesn't have enough information to clearly specify the column.
I want my query to ask the user for 1 date and use that same date to create a between date condition in my query. I manage to get the date to be used in the query, but I can't seem to be able to add +6 days to it.
Field
dateRecorded
Condition
Between [Enter start date(mm/dd/yyyy)(Monday)] And [dateRecorded]+6
I don't want the user to enter 2 dates to filter by.
If you enter more than one parameter with the same request string it will only ask once and use the same input:
Between [Enter an integer] And [Enter an integer]+6
However I don't think this will work with dates; I know it does with integers etc.
I also agree with comments in question that it is better to use a form for such things to get more control; validation of correct dates such as ensuring the date entered is a Monday.
I have a table which has a TEST column which contains many values:
TEST
2014-04-02
2014-04-03
2014-04-04
WEEKLY TOTAL
PRIOR WEEK
12 WEEK
How can I write an expression using IIF statement so if the row contains a date then change the date to a different format?
For example:
The first row has 2014-04-02 (yyyy-mm-dd) which should be changed to 02-Apr (dd-mmm)
The last row has 12 week which should not be touched because it's not a date
Solution 1:
=iif(isDate(Fields!Test.Value)
,FORMAT(
CDATE(iif(isDate(Fields!Test.Value), Fields!Test.Value, Nothing))
, "dd-MMM"
)
,Fields!Test.Value)
Solution 2:
Handle it in SQL itself using CASE WHEN
IF all of your dates have a '-' AND none of your text has a '-':
=IIF(Fields!TEST.Value like "*-*", FORMAT(CDATE(Fields!TEST.Value), "dd-MMM") ,Fields!TEST.value)
Not tested, but should work. Edited to return an actual date.
Edit: after some more experimentation, it dawned on me that what you want would result in the SSRS column having an inconsistent type (date/string), and I don't think it is possible to have both string types and date types in the same column.
My mistake was not to realize this sooner.
In order to return actual dates, you will need to clean/filter your data.
I am working on a SSRS report that displays Date, Time and few other columns.
My SP returns just Date Column (which has time part in it) and a few other columns.
In the report I want to group by Date Part and show all details including the time (I used formatting option "T" to display only Time in Date column) in the details group.
For grouping on Date I used:
=FormatDateTime(Fields!TxDate.Value, DateFormat.ShortDate)
Which seems working. However if I try to sort on other columns it is not working. Any thoughts/suggestions on this?
It might be easier if you were to add an extra column into your dataset that was based on your original date+time column but containing just the date. Then you can use this to do a simple group on that column.
For example, if the dataset is based on a SQL query and your date+time column is called [Date], then add another column in the query as CONVERT(DATE, [Date]) AS DateOnly or something similar.
I have a form in which I enter a record and I have a field that automatically updates with the current date. I would like to add a subform that tells me how many records have been entered "today" based on current date (today's date). I would like it to keep a running total. I am new to asking questions in this format and appreciate any help and understanding.
For Access:
SELECT COUNT(*) FROM ... WHERE add_date BETWEEN DATE() AND DATE()+1;
as suggested by David W. Fenton in the comments.