Using SSRS line charts to graph time periods on the y-axis - reporting-services

I am looking to to use an SSRS line chart to graph ending run times of jobs. I am using runtime on the y-axis and date on the x-axis. The graph looks like a flat line and the times do not show up on the y-axis, but integers show.
I also want to put a target line at a specific time to show our SLA time.
Here is example of data I am trying to graph, but I want a line.
+-------+----------+
| y | x |
+-------+----------+
| 10:05 | 3/1/2009 |
| 11:00 | 3/2/2009 |
| 10:15 | 3/3/2009 |
+-------+----------+
+-------+----------+----------+----------+
| 11:00 | | x | |
| 10:45 | | | |
| 10:30 | | | |
| 10:15 | | | x |
| 10:00 | x | | |
+-------+----------+----------+----------+
| | 3/1/2009 | 3/2/2009 | 3/3/2009 |
+-------+----------+----------+----------+

Lets say you have table Times with Date and Hours.
Declare Report parameter #LimitHourParam decimal - for target time.
Set query of dataset:
SELECT Date, SUM(Hours) AS Hours, 'Actual Hours' AS LimitHour
FROM Times
GROUP BY Date
UNION ALL
SELECT DISTINCT Date, #LimitHourParam AS Hours, 'Hours Limit' AS LimitHour
FROM Times
So you will get in result hours grouped by dates and some hour limit for unique each date.
Place Chart control in report page.
Go to Chart Properties->Data
Press "Add Values"
Erase value of Label and set Value to
=Sum(Fields!Hours.Value)
Go to "Point Labels" tab of "Edit Chart Value" dialog, check "Show point labels", set Data label to
= String.Format("{0}:{1}", (Fields!Hours.Value / 1) - (Fields!Hours.Value Mod 1), (Fields!Hours.Value Mod 1)*60/1 - (Fields!Hours.Value Mod 1)*60 Mod 1)
Add Category Groups, set "Group On" expression to
=Fields!Date.Value
Add Series Group, set both "Group On" expression and Label values to
=Fields!LimitHour.Value
Go to Chart Properties->X Axis, set labels format dd/mm/yyyy
Result should look like this:

Related

MS-Access : Query to generate dates for recurring events?

I'm not too familiar with the more complex queries and I'm having an issue finding some examples to take apart to utilize..
Event Name | Due Date | Frequency |Frequency UOM
S-XYC-001 | 10/17/2020 | 360 | D
S-XYA-003 | 6/1/2020 | 90 | D
S-XYC-004 | 4/3/2020 | 180 | D
So, we have a set of work that has an initial due date provided, and an expected frequency along with a unit of measurement (I've converted all my frequencies into days as there was previously a mix of days, quarterlies, months..).
I've been asked to generate a forecast of events in 2020. So, using the above source table we'd expect our list to look like this:
Event Name | Due Date | Frequency | Frequency UOM
S-XYC-001 | 10/17/2020 | 360 | D
S-XYA-003 | 6/1/2020 | 90 | D
S-XYA-003 | 8/30/2020 | 90 | D
S-XYA-003 | 11/28/2020 | 90 | D
S-XYC-004 | 4/3/2020 | 180 | D
S-XYC-004 | 9/30/2020 | 180 | D
I'm really not quite sure what type of query to apply to get these results, Or honestly what to look for to get some examples I can utilize to do what I need to.
First, change your frequency to months - 12, 3, and 6 respectively - to obtain the correct result dates.
Then, create a small query and save it as Ten as it simply returns 0 to 9:
SELECT DISTINCT
Abs([id] Mod 10) AS N
FROM
MSysObjects;
Use that in this generic query that is capable of generating any sequence of date/time in the entire range of DateTime:
PARAMETERS
[Interval] Text ( 255 ),
[Number] IEEEDouble,
[Date] DateTime,
[Count] IEEEDouble;
SELECT
[Ten_0].[N]+[Ten_1].[N]*10+[Ten_2].[N]*100+[Ten_3].[N]*1000+[Ten_4].[N]*10000+[Ten_5].[N]*100000+[Ten_6].[N]*1000000+[Ten_7].[N]*10000000 AS Id,
DateAdd([Interval],Fix([Number])*([Ten_0].[N]+[Ten_1].[N]*10+[Ten_2].[N]*100+[Ten_3].[N]*1000+[Ten_4].[N]*10000+[Ten_5].[N]*100000+[Ten_6].[N]*1000000+[Ten_7].[N]*10000000),[Date]) AS [Date]
FROM
Ten AS Ten_0,
Ten AS Ten_1,
Ten AS Ten_2,
Ten AS Ten_3,
Ten AS Ten_4,
Ten AS Ten_5,
Ten AS Ten_6,
Ten AS Ten_7
WHERE
((([Ten_0].[N]+[Ten_1].[N]*10+[Ten_2].[N]*100+[Ten_3].[N]*1000+[Ten_4].[N]*10000+[Ten_5].[N]*100000+[Ten_6].[N]*1000000+[Ten_7].[N]*10000000)<[Count])
AND
(([Interval]) In ("s","n","h","d","w","ww","m","q","yyyy"))
AND
((Fix([Number])*([Ten_0].[N]+[Ten_1].[N]*10+[Ten_2].[N]*100+[Ten_3].[N]*1000+[Ten_4].[N]*10000+[Ten_5].[N]*100000+[Ten_6].[N]*1000000+[Ten_7].[N]*10000000) Mod IIf(Fix([Number])=0,1,Fix([Number])))=0)
AND
((Ten_0.N)<=[Count]\1)
AND
((Ten_1.N)<=[Count]\10)
AND
((Ten_2.N)<=[Count]\100)
AND
((Ten_3.N)<=[Count]\1000)
AND
((Ten_4.N)<=[Count]\10000)
AND
((Ten_5.N)<=[Count]\100000)
AND
((Ten_6.N)<=[Count]\1000000)
AND
((Ten_7.N)<=[Count]\10000000));
Save it as DatesSequence.
This you can run with the parameters:
Interval: "m"
Number: 3, 6, or 12
Date: Due Date
Count: The count of future event dates to list
Results:
You could modify the query to filter out dates later than 2020.

Graph cursor dont show my data but draw it properly

I have the next information in a mysql table:
+-----------------+----------+------------+----------------+---------------+
| time_stamp | m_value | pt_periode | meter_id_meter | mType_id_mtype|
+-----------------+----------+------------+----------------+---------------+
|2019-03-01 00:00:00 | 1800 | 0 | 1 | 22 |
+-----------------+----------+------------+----------------+---------------+
etc
Well, I have three meassures (march, april and may) for the day 1 of every month at 00:00:00. When I do the next query in grafana:
SELECT
time_stamp AS "time",
m_value
FROM menergy
WHERE
meter_id_meter = 1 and mtype_id_type = 22
order by
time_stamp
I get the time graph that looks fine, it represent the three values at the correct time but when I put the cursor on the graph the measure value is 0 and after the correct value, the next point go to 0.
Is it a query mistake?
https://drive.google.com/file/d/1dcLiGdDDpxtp3Jlt5Mpqgis5d3gVZyw_/view?usp=sharing

Grafana graphing query displays 1 point but has multiple results

I am currently trying to set up a query in Grafana to display a graph. I have data in the database and my query returns the results I expect, but the graph seems to only display the smallest result.
Table [test_statements]
| ID | ReportTime | LapTime |
| 1 | 2018-03-29 13:02:06 | 2700 |
| 2 | 2018-03-29 13:03:06 | 2725 |
| 3 | 2018-03-29 13:04:06 | 1645 |
| 4 | 2018-03-29 13:05:06 | 2900 |
| 5 | 2018-03-29 13:06:06 | 3101 |
The template is structured as:
SELECT UNIX_TIMESTAMP(<time_column>) as time_sec,
<value column> as value,
<series name column> as metric
FROM <table name>
WHERE $__timeFilter(time_column)
ORDER BY <time_column> ASC
Current Query
SELECT
UNIX_TIMESTAMP(ReportTime) as time_sec,
LapTime as value,
'ReportTime' as metric
FROM test_statements
WHERE ReportTime > 0
ORDER BY ReportTime ASC
Here are my results:
I can see the ReportTime results are correct, but the graph is wrong.
Not sure what i'm doing wrong but a point in the correct direction would be helpful. Thanks.
Since there are no time scale labels on x-axis in screenshot
most likely you have Format as in graph editor's Metrics tab set to Series or Table instead of Time series.
Thus, what you see as y-axis value is the total (sum) of your individual datapoint values (approx. 7 * 2.7K) which is the default setting for series aggregation function. And x-axis is labeled with time series name(metric).

SSRS Dynamic Running Total

I am trying to include a cumulative total column in a matrix on a report.
This is the expression I am using at the moment:
=RunningValue(Ceiling((SUM(Fields!MINUTES.Value)/60)*4)/4,Sum,"RowGroup")
The problem is the total seems to reset on each day.
I have 3 groups on the report: Parent is Day of month, type, then sub type.
I want it so that the sub types will accumulate across the days:
So 1st june/holiday/annual = 2 - cumulative = 2
.. 2nd june/holiday/annual = 1 - cumulative = 3
rowgroup in the expression above is the 3rd level sub type group in the matrix.
Whatever I try I cannot get it to total up over the days, like i said above it seems to not carry over to the next day.
Below is a sample dataset:
+------+------------+---------+----------+---------+
| User | Date | Type | Subtype | Minutes |
+------+------------+---------+----------+---------+
| 158 | 13/02/2015 | Holiday | Annual | 90 |
| 158 | 13/02/2015 | Meeting | Training | 300 |
| 158 | 13/02/2015 | Lunch | Lunch | 60 |
| 158 | 03/06/2015 | Holiday | Annual | 120 |
| 158 | 03/06/2015 | Meeting | Meeting | 285 |
| 158 | 04/06/2015 | Holiday | Sick | 120 |
| 158 | 04/06/2015 | Holiday | Annual | 200 |
+------+------------+---------+----------+---------+
My matrix column group is the user.
The row groups are date, then type, then subtype.
I then have a total column outside the column grouping.
I'm now trying to add in to the report a cumulative total based on the type and sub-type columns, that sums up the minutes.
As an example (looking at the holiday, annual entries):
03/06/2015 - 120 minutes
13/02/2015 - 90 minutes = 210 minutes
04/06/2015 - 200 minutes = 410 minutes.
Taken from the MSDN page for RunningValue, adding a scope to your expression will have this effect.
The value for RunningValue resets to 0 for each new instance of the scope. If a group is specified, the running value is reset when the group expression changes. If a data region is specified, the running value is reset for each new instance of the data region. If a dataset is specified, the running value is not reset throughout the entire dataset.
To fix the issue, simply remove the scope:
=RunningValue(Ceiling((SUM(Fields!MINUTES.Value)/60)*4)/4,Sum)
This will have the total run across all days (As days are your top-most level). If this is incorrect could you perhaps give us an example of what the report is currently doing, and what you want it to do?

Hide all middle columns in SSRS

I have a matrix report in SSRS 2008 displaying information about a Company and the total points earned by each company for a selected Quarter.
Example
Company | Current | Previous | Diff |
--------------------------------------
| Q3 2008 | Q2 2008 | |
--------------------------------------
Comp 1 | 2000 | 1500 | 500 |
--------------------------------------
Comp 2 | 1200 | 1400 | -200 |
--------------------------------------
In my SSRS report I have a RowGroup based on my Company field from the data set ([Company]).
And I have a ColumnGroup based on my Quarter field from the data set. Sorting in the group is reversed because I want to start with the latest quarter.
I have parameter for selecting companies and 2 parameters for selecting quarters (QuarterCurrent and QuarterPrevious).
As a side effect if I select 2 quarters that are not consequent I get more than 2 columns which is something that I do not like.
But then I thought that if I could hide the columns in the middle and display on the First (QuarterPrevious) and the Last (QuarterCurrent) I will be able to compare any quarter to any other quarter.
My question is about hiding the columns in the "middle" of the matrix. I am trying to
achieve something like this:
Company | Current | *(HIDDEN)* | Previous | Diff |
----------------------------------------------------
| Q3 2008 | *Q2 2008* | Q1 2008 | |
----------------------------------------------------
Comp 1 | 2000 | *1500* | 1300 | 700 |
----------------------------------------------------
Comp 2 | 1200 | *1400* | 1250 | -50 |
----------------------------------------------------
So in the end I will have only the Current and the Previous columns visible.
I tried the following approaches:
Setting the Column Visibility property to:
=IIF(StrComp(Fields!Quarter.Value,First(Fields!Quarter.Value))=0 OR StrComp(Fields!Quarter.Value,Last(Fields!Quarter.Value))=0,False,True)
In my understanding this should set the property Hide to False to each column that is equal to the First and the Last values in the sequence, and to True to all the others. However it does not happen like this, but all columns were hidden.
I tried setting the same expression to the Visibility property in Group Properties. Still has the same effect - all columns were hiding.
Edit : format code
Instead of two parameters for your quarter selection, have you tried a multi-select dropdown parameter ?
I solved the issue in the following way:
Instead of using parameter with range (From and To) I used a parameter with two values and my queries is not BETWEEN From and To, but rather IN [From, To]. The values of From and To can be any 2 quarters (they can even be switched - From does not have to be before To).