MS Access - Display days as number of years in combobox - ms-access

The row source of my combobox is set to "365;730;1095;1461;1826".
I need to store the values in my table as number of days but I want to display them as years (1;2;3;4;5) from my combobox.
Is it possible? How?
I've tried =Year([Duration]) but it doesn't work.

Use two columns:
"1;365;2;730;3;1095;4;1461;5:1826"
and hide the second column.
That said, the count will only always be true for four years due to the leap years.

Related

Is there a way for mysql field value to be constantly updated based on another field value? [duplicate]

This question already has an answer here:
Using a stored date field to calculated a field that computes current number of days passed
(1 answer)
Closed 7 months ago.
I want to create a field "date_added", where it stores the date when an item has been added to stock. Additionally, I want another field "days_on_shelf", where it shows the amount of days the item is on the shelf. Is there a way that I can use the current date and the date added to calculate the value of the days_on_shelf field? I also want it to be constantly updated as the days go by to increment the days.
This can be done with a trigger
See more at: https://dev.mysql.com/doc/refman/8.0/en/trigger-syntax.html
For the days on shelf field you can just use a generated field

Hide Multiple Columns in SSRS Matrix

I have a Matrix report with some columns that are grouped by Month and Year in the Column Group. Now, these columns are being toggled by the Month Column as the Visibility Property is set to hide but toggled by the Month Column. But when the report is rendered, the hidden columns come out as blank and this defeat the purpose of the report, as seen in the images below. How do I do away with the blank spaces or which is the best way to meet this requirement?
I'm assuming you tried to set the individual column visibility properties...
You actually need to set the group visibility of your EnglishMonthName group to be toggled by [CalendarYear]. This will not hide the column completely (as you would not have anything visible to click on to get it back again) but it will collapse the data down and aggregate at the year level.
What you have done to hide your columns is actually working.
If you look at that WIDTH of each of the month then you will see they are of the same width. So according to your query you have the months appearing regardless of the corresponding data for that month.
I would do in two way depending on how the users would like it.
If possible and for better performance, I would alter the SQL query and do one of the following:
1. The months for which there is no corresponding data - I would remove the month names (or ID) as well
2. Rather than returning NULLs I would return a valid value like 0 or 'N/A' this will how the month as well as what the data actually is
To do it in the matrix you will need to alter the visibility of the month row as suggested by Alan Schofield

Editing an existing report and now a repeating table is out of order

I am editing an existing report. After adding 2 columns to the end of one of the tables it has a weird behavior that I don't know how to fix or why it starting doing it. Google searches yielding nothing, primarily because I didn't know a concise way to pose a question.
The 'title' bar of this table has its first title as an Expression. This expression simply displays the name of a month or the words 'Year To Date' based on the field value it receives from my stored proc.
Months January to May display in order, THEN it displays Year To Date, followed by the remaining months in their proper order. Not sure why it is doing it or where to look for problems.
The tables should display all the months in order followed by the Year To Date table. Below is the expression used for the textbox:
The report is much to large to display a screenshot of it.
Where would I look for a setting that determines the order for displaying the generated tables?

find if data existed 6 months ago ssrs

In SSRS report builder I am trying to write an expression for calculated fields in my dataset to see if this data exists now, existed 6 months ago, and existed a year ago. (So 3 different calculated fields).
I don't want to use different datasets as the information all needs to go into a table with a percentage change column.
I have the from and to dates of the data and have been trying to write something along the lines of
=IIF(Fields!From.Value<-6months AND Fields!To.Value>-6months, true, false)
I'm obviously missing something in my expression but my knowledge in this is limited. Any ideas on how to get this to do what I want it to?
my data basically is this (but being pulled from various tables in our database)
person ID - condition 1 - from date - to date
person ID - condition 2 - from date - to date
person ID - condition 1 - from date - to date
person ID - condition 3 - from date - to date
etc.
I've been asked to make a table with the conditions as the rows, the columns are "exists now", "existed 6 months ago" and "existed 12 months ago" and a count of the person IDs as the data
the from and to fields are date fields
The visibility thing can be a little confusing sometimes, as with everything in SSRS it can be finicky.
Since you're new at this I would recommend something easy like trying to hide your first row. You'll probably want to do this by right clicking the table and going to properties. Under visibility, you can add an expression. Try hiding a row by the unique ID or something like that first...
=IIF(Fields!UID.Value=1234, TRUE, FALSE)
The reason I say to go through this is to make sure you're able to properly hide a row. If you are using the visibility in groups instead, sometimes it doesn't work expected. Anyway, once you get that working, you'll want to do something like this.
=IIF( (DateDiff("m", CDate(Fields!FromDate.Value), Now()) < 5 AND DateDiff("m", CDate(Fields!ToDate.Value), Now()) > 5), FALSE, TRUE)
You'll be using the DateDiff function to calculate the difference between the date and NOW() (which returns current date). The "m" specifies you want to know how many months between dates. CDate will cast your field into a DateTime object.

Fetching a value of a text box in a matrix report in SSRS

I am working with a matrix report in ssrs.
Here is a sample screenshot of my report extracted in excel
The report is simple enough. It shows the data for different years (example : AS OF JAN,2012).
The netrevenue for the years are defined in the database so they are fetched accordingly. The problem is with the other sub columns. Like the "%Change" column.
The column value is calculated with the help of following formula
%change = ((NetRevenue of The current year / NetRevenue of the last year) - 1) * 100
Now what I doing to solve this problem is calculate the values using sql queries for every column and then binding it directly to the control.
My question is that is there a simpler way to do this. I mean like in table control I can access the value of a cell by using
ReportItems!Textbox1.Value
Is there a way I can access the dynamic columns of the matrix report. Like accessing the netRevenue values for different years.
If more clarification is needed for the question then please ask.
Thanks in advance.
I believe the only issue your going to have is getting the revenue at the past year?
In this case you'll need to calculate the last years revenue in the sql. Then use:
=((RpItems!NetRev.Value / RpItems!NetRev_LastYr.Value) - 1) * 100
With this case you'll need to calculate all the last years values for the % changes you want to calculate.
Can I suggest you look into this and raise another question with the sql you currently have?
I've found this works best.