I'm working on WebI 4.2 Support Pack 4 Compilation : 14.2.4.2410. I have an array with the number of days to make an action. For example 967 times an action was make in 0 day.
I only want to display lines with 0,1,2,3,7 (one week),14 (two week),21,30 (one month),90 (three month) and more than 90 days cause it will be more relevant for my report. I tried to make a Running Sum on my number of days to get my total of action and then a percentage but it failed.
My formula only takes values of the displayed days skipping others. I use this formula to get my interesting days :
=[number_day] Where([number_day]In(0;1;2;3;7;14;21;30;90))
I don't understand why I have an empty frame after '90', i tried to insert the max value of "Number of day" after but that failed too.
Finally how can I get =0+1+2+3+4+5+6+7 in front of '7' instead of =0+1+2+3+7 here is the formula i used : =RunningSum([total_action])
I do not quite understand why you want to do this in the manner you have stated. Or maybe I am just not understanding it correctly.
It seems to me you need to create a variable to group your day numbers. Something like this...
DayNumberGroup=If([number_day] InList(0; 1; 2; 3; 7); "One Week";
If([number_day] InList(14); "Two Week";
If([number_day] InList(21; 30); "One Month";
If([number_day] InList(90); "Three Month";
"Three Month+"))))
Then your running sum variable should look like this...
DayRunningSum=RunningSum([Action Sum]; ([DayNumberGroup]))
Having DayNumberGroup as the second parameter for the RunningSum() function causes the sum to restart on a change in the value of DayNumberGroup.
I am not sure why you are excluding the values of 5, 6, 8, etc., but in order for them to not be lumped into "Three Month+" you are going to have to add a filter to your table to exclude them.
Hope this gets you on the right track.
Related
I'm stuck with a problem in SSRS 2012 that maybe is very simple:
I have a matrix with a group row (employee) and a group column (last 12 months); the values are COUNT(practicesDone) - i.e. the amount of practices worked.
I want the matrix to show an extra column on the right (after all the columns of the months, and clearly outside the column group) with again the number of practices for the current month.
Is it possible to achieve that?
thank you in advance!
You can do this, it's pretty simple.
I have assumed that your dataset contains a column that has a date for each entry and that the data returned only covers 12 months so the same month would not appear for different years. If your data does have multiple years, look at the second expression below.
Right-click your month column and then to "Insert Column --> Outside Group - Right"
Now set the expression for the text box to
=COUNT(IIF(MONTH(Fields!myDateColumn.Value) = MONTH(TODAY()), 1, Nothing))
You could swap COUNT for SUM and it should do the same thing but either will work.
All we are doing here is comparing the all data in scope which, due to the placement of the text box means the scope is the entire rowgroup. Then for all that data, check if the month matches the current month, if it does set it to 1 is not set it to nothing then count/sum all results. Count conveniently ignores 'nothing'.
If you data covers more than 12 months then you can still do this but you'll have to add a bit more to handle years and months like this.
=COUNT(
IIF(
MONTH(Fields!myDateColumn.Value) = MONTH(TODAY())
AND YEAR(Fields!myDateColumn.Value) = YEAR(TODAY()),
1,
Nothing
)
)
I am trying to calculate the difference in days between 2 data sets and then if the value is between 1 and 2 days then it should show compliant if the value is a negative number or greater than 2 days I want it to show non-compliant. I am not sure what I have wrong, it runs however they all show compliant
Background on the calculation needed.
IMM Discharge compliance - Hospitals must
deliver a copy of the signed notice to each beneficiary not more than two (2) days before the day of discharge. Follow-up notice is not required if delivery of the initial IM falls within two (2)
calendar days of discharge.
FYI - the first IFF statement is because some do not have dates so that was to account for those
=IIF(
IsNothing(Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")),
"No Intervention",
IIF(
DateDiff("d",Fields!Actual_Discharge_Date.Value,Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")) <=2,
"Compliant",
"Non-compliant")
)
I have tried multiple variations =1 or 2, etc if I use just the =2 they all show non-compliant
You have two conditions for non-compliance - the difference being negative or greater than 2 days so you have to check both conditions. Try something like this:
=IIF(IsNothing(Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")),
"No Intervention",
IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) < 1,
"Non-compliant",
IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) > 2,
"Non-compliant",
"Compliant"
)
)
)
I am working on a report in Access 2013 I need to seperate the first 20 records in a column that contain a value and assign a name to them. Such as at 1-20 I need it to insert Lot 1 at 21-40 need to assign Lot 2 etc... The report needs to be separated by lots of 20. I can also just insert a line when it reaches sets of 20 without a name if that makes it easier. Just need something to show a break at sets of 20.
Example: As you can see the report is separated by welder stencil. When the count in the VT column reaches 20 I need to enter a line or some type of divider to separate data. What our client is asking for is we separate the VT in sets of 20. I don't know whats the easiest way to accomplish this. I have researched it but haven't found anything.
Example Report with Divisions
Update the report's RecordSource query by adding "Lot" values for each row. There are multiple ways of doing this, but the easiest will be if your records already have a sequential, continuous numerical key. If they do not have such a key, you can research generating such sequential numbers for your query, but it is beyond the scope of this question and no details about the actual data schema were supplied in the question.
Let's imagine that you have such a key column [Seq]. You use the modulo (mod) and/or integer division operators (\ - backslash) to determine values that are exactly divisible by 20, e.g. ([Seq] - 1) mod 20 == 0.
Generate a lot value for each row. An example SQL snippet: SELECT ("Lot " & (([Seq] - 1) \ 20)) As LotNumber ...
Utilize Access report sorting and grouping features --grouping on the new Lot field-- to print a line and/or label at the start of each group. You can also have the report start a new page at the beginning or end of such a group.
The details about grouping can be found elsewhere in tutorials and Access documentation and are beyond the scope of this question.
I'm trying to multiplay a field of type time. Sometimes it works and sometimes it doesn't. This is in phpmyadmin with MySQL.
Things I have tried already:
I have tried googling 'sql multiplying time type returns 00:00:00'
but have no luck with that or similar searches.
I ran a python script that pulled all these times and multiplied them
by 6 and 11 and all of them worked - there were no 00:00:00.
I have also tried doing it individually on a row, and it didn't work
for the same ones.
Below are pictures before and after I run this query:
UPDATE journeys, travel_type
SET journeys.jo_duration = journeys.jo_duration * travel_type.tt_duration_multiplier
WHERE journeys.jo_type = travel_type.tt_id
I get no errors.
Some probably helpful information:
Type 1 means 11 - so I want the value in jo_duration to be multiplied by 11. Type 3 means 6 (same principle). 2 means 1 (so nothing changes).
There are more rows in this table that have this problem but I didn't want to screenshot the whole table. I thought this should be enough. There are 70 total rows. When I run the above query it says '47 rows affected' (when all rows should technically be affected I think?). I'm not sure if the remaining aren't affected because they're type 2 or if they're the ones being turned to 00:00:00 (or both)?
If you need more information, feel free to ask!
As you can see below, rows with jo_id; 1, 3, 4, 6 are 00:00:00. But others multiply correctly?
Does anyone know why this is? And how I can prevent it?
Sorry for the long post and I hope my problem has made sense!
Thank you!
Before:
After:
You can't directly multiply number to a time datatype.
Use function time_to_sec and sec_to_time:
update journeys, travel_type
set journeys.jo_duration = sec_to_time(
time_to_sec(journeys.jo_duration)
* travel_type.tt_duration_multiplier
mod 86400)
where journeys.jo_type = travel_type.tt_id
mod 86400 is there to remove the day part if the time becomes more than a day
Alright, this is kind of a convoluted problem, so bear with me:
I have a chart that displays 25 hours worth of data from rows sent to it. The hours of the data are to be displayed starting and ending with the 22nd hour. That is, the x axis goes 22, 23, 0, 1, 2, ... 22. It's important to note that there are two 22nd hours on two separate days.
Now, it is possible that the database will not return some rows. In which case, there must be an empty space for that hour. However, there must still be 25 x axis values.
This combination of restrictions has me stumped. I can't represent the x axis as a custom scalar, because the values are to be displayed out of order and duplicated. And I can't find a way to use an x axis category because I won't get all of the categories from the data and, again, there is a duplicated 22nd hour.
Any help is appreciated, let me know if I can provide any additional information.
I would add a column to the dataset to calculate a "relative hour". This would start with a value of 0 for the 22nd hour, 1 for the 23rd etc finishing with 25 for the 2nd 22nd hour.
Then I would change the Category Group definition in the Chart to use that "relative hour" value as the "Group On" value. Note the Label can remain as is.
I would change the source dataset so that it always returns a row for all the 25 x axis values, e.g. via a right join to a numbers table. Rows representing those "missing" hours will need both the "relative hour" value and your existing hour column value for the label.