I would like to add a column to my datasheet that uses a date expired field and today's date in a formula and then display if it is active, pending expiration, or expired. Here is what I have tried and Access:
IIf([Date Expired]-Date()>60,"Active",IIf([Date Expired]-Date() < 60 AND [Date Expired]-Date() => 0,"Pending Expiration","Expired"))
I start by going to the Design View of the datasheet. By going to the first open row at the bottom and selecting Calculation from the menu options in the second column, it brings up the expression builder.
When I try to enter the formula like the one above into the access expression builder window, it says I cannot enter a formula like that in a calculated column.
How can a get a column to display the results of a formula like this?
You can't use the word AND you need the function AND(test1,test2)
IIf([Date Expired]-Date()>60,"Active",IIf(AND([Date Expired]-Date() < 60 , [Date Expired]-Date() >= 0),"Pending Expiration","Expired"))
Related
I am using Paginated Reports against a dataset published in the cloud. I click on Query Designer to drag all the columns to the page and build my query parameters (i.e, not report parameters). When I add my date parameter, I have options in the dropdown of 'equal to', 'not equal to', 'contains', 'begins with.', 'range(inclusive)', 'ange(exclusive)', and 'Custom'. I want the date parameter such that when the user selects a date in the parameter prompt, the query returns 13 months of data, ending on the date they select in the parameter, so if they select 10/31/22, the results will be 10/31/21 thru 10/31/22. I don't want the user to have to enter a start and end date range if I don't have to. Given the parametr options I have, I don't see how to do this. I thought about modifying the code of the resulting query statement (it begins with EVALUATESUMMARIZECOLUMNS). I see logic in the code that says 'RCustomDaxFilter(#Date,EqualtoCondition'. I thought about changing the 'EqualtoCondition' to something like 'Between', but nothing works. Thanks for any assistance!
Good day
I am very very new two paginated reports so forgive me if this is a silly question
I have a report that displays values for Mondays to Fridays based on the date selected from a date picker.
So basically
You select a date (Example 24 Nov) and the following table is displayed based on values pulled from SQL.
Now my question is how do I display the dates of the weekdays too?
So if the date selected is Thursday 24 Nov, in the column headers under the week day names it should give the corresponding date i.e Monday-21/11/2022, Tuesday - 22/11/2022, etc.
Below is a little snippet of the data
So the date picker is based on the ReportingDate column. The rows of the matrix consist of Region and Country and the values are the sum of Monday-Friday.
Any guidance would be greatly appreciated.
Edit: The day names are not obtained via an expression in SSRS. They carry over from the column headers in the data set.
Assuming you have some expression to get the actual day name already, you can leave that bit as it is.
Now, double click the column header "cell"/textbox to get a cursor in there, then click at the end of the existing fields/expression.
Now just put a space in and then right-click and choose "Create Placeholder". The placeholder dialog will appear.
This placeholder acts almost like a separate textbox to you can put whatever you want in there, click the '[fc]' button next to the Value property and then set this to whatever you want, e.g. =Fields!ReportingDate.Value.
Now go to the "number" tab on the same dialog box and set the format to the required date format.
If you want to edit this later, just double click the cell again but this time right-click the placeholder and choose properties.
The other way of doing this would be to add another row to your header and set that to be the date instead but then you have to mess around removing borders etc., sometimes this can be easier if layout is an issue but you have a couple of options at least now.
I managed to figure it out with the help of the following post.
These are the steps I followed
Get the date of the first day of the current week (Sunday's date) using the formula explained in the link
DateAdd("d",1- DatePart("w", CDate(Parameters!ReportingDate.Value)), CDate(Parameters!ReportingDate.Value))
Use DateAdd to add the corresponding number of days to get to a required weekday. That is for Monday add 1, Tuesday add 2,...
DateAdd("d",1,DateAdd("d",1- DatePart("w", CDate(Parameters!ReportingDate.Value)), CDate(Parameters!ReportingDate.Value)))
Format datetime to date and add new line to insert date below day name
="Monday" + Environment.NewLine + FormatDateTime(DateAdd("d",1,DateAdd("d",1- DatePart("w", CDate(Parameters!ReportingDate.Value)), CDate(Parameters!ReportingDate.Value))), DateFormat.ShortDate)
I am attempting to pull records from a specific period into a form. I need to be able to pull the information from a date field within a table to put into the form. I need it to prompt for a date range and that date range show in the form/report. I am having trouble making this work.
Thanks
The following is an example of selecting a date range using parameters that you specify. It will prompt you to enter a start and end date
AND it will return the dates you selected as fields in the query.
You can use the start/end fields in your form/report.
SELECT [Table1].*, [StartDate] AS MyStart, [EndDate] AS MyEnd
FROM Table1
WHERE ((([Table1].DateAdded) Between [StartDate] And [EndDate]));
I need to add a "STATUS" field to an Access table... Creating the field is the easy part.
I need to display one of three words based on a date from another field.
So in the "Status" field I need to take the date and if it less that 180 days from the date field have the "Status" field display "CURRENT"
If the date is between 181 days and 365 days I need it to display "SUSPENDED" and over 365 days I need it to display "EXPIRED".
If it is also possible to have the field show color based on the current, suspended, expired output that would be a bonus.
I find using calculated columns in tables can be cumbersome and you are limited to what you can do. I would recommend creating a query on your table instead and add the following expression to a new query field:
Status: IIf(DateDiff("d",[YourDateField], Date())<=180,"CURRENT",IIf(DateDiff("d",[YourDateField], Date())>=181 And DateDiff("d",[YourDateField],Date())<365,"SUSPENDED","EXPIRED"))
Make sure to test this a let me know if the calculation is right for each scenario. I may have it backwards.
As far as formatting the field based on the status, this can be accomplished with a textbox in a form or a report. If you select the "Status" textbox in the form/report's design view and then in the ribbon go to the "Format" tab in the "Form/Report Design Tools" menu, click on "Conditional Formatting". There you can specify rules to the textbox background color based on what the status value is.
Hope this helps!
On the form where you are presenting your data you can create a calculated value in a textbox. You can use Conditional Formatting to change the color (in datasheet view) or VBA (in Form view)
Alternatively if you are using a query to present your data on your form you can add another table with these threshold dates and join to it. Then your dates can be dynamic and not hardcoded into your forms.
Use a Switch() expression in a query to derive "Status".
Here it is formatted with each condition/value pair on a separate line. Similar to a VBA Select Case ... End Select block, Switch() returns the value from the first condition which evaluates as True, and ignores the rest.
Switch
(
DateDiff('d', [YourDateField], Date()) < 181, 'CURRENT',
DateDiff('d', [YourDateField], Date()) BETWEEN 181 AND 365, 'SUSPENDED',
DateDiff('d', [YourDateField], Date()) > 365, 'EXPIRED',
True, Null
)
The last condition catches any YourDateField value (eg Null) which doesn't satisfy one of the first three conditions.
I have a chart and matrix that shows records for a given date range. User wants to see the records for indidual months.If the user selects date range from January to April then the results would be 4 charts and 4 tablix based on month instead of single chart and single tablix that shows for all months. Could anyone please help me on how to do that. TIA
Create a list
Insert your existing Tablix/Matrix into the body of the list
Right click the Row header (grey box) of the List and on the General tab set the Group expression to group on the Month value, i.e.
=Month(Fields!myDate.Value)
Right click the Row header (grey box) of the List and on the Filters tab set two expressions.
Expression Operator Value
-------------------- -------- --------------------------
=Fields!myDate.Value >= =Parameters!StartDate.Value
=Fields!myDate.Value <= =Parameters!EndDate.Value
This approach will then take an output that looks like this (for all months)
When applied, and the parameters set so that StartDate = 01/Jan/2015 and EndDate = 28/Feb/2015, will look like this
Note how the data for each month appears separately.
Let me know if this approach works for you, or if you need any further assistance.