Add default parameter regarding time SSRS - ssrs-2008

I am developing a report on task performance based on their working shift. Day shift will start on 9am to 9pm and night shift will start from 9pm to 9am. I would like to display data based on their current working shift as example, if someone is working on day shift and view report on 8pm, the report will show from range 9am to 8pm only and if user working for night shift, the report will only show from 9pm to 9am range
I have a dataset and parameter which is #begin_date and #end_date (eg. Monday, Tuesday...), #begin_hour and #end_hour. I got column "time" where the task complete.
Can someone help me?
EDIT:
Sorry, can you guide me, this is my propose sample code. Let say the current date is monday
If time <= 21 begin show 9am to (current time, limit 9pm monday) end Else if time >= 21 Begin Show 9pm to (current time, limit 9am tuesday)
End
How can i do this in sql?

Don't use a parameter at all. Add the logic into the stored proc or query that returns the results. Only show results from the beginning of the shift up to the current time.

Related

Talend - How to loop over Date of Birth till the Current Year using tloop or tmap?

I have a requirement where I am giving Date of Birth from tRowGenerator. I want to loop till the current year i.e. from date of birth to current year and display values in tlogrow.
I'm able to print Years, Months, seconds, M seconds difference using TalendDate diff function but not in a loop.
I tried figuring out a solution but could not succeed. Can anyone help me out?
Total result in 1 log:

Show realtime charts in SuperSet with Druid

How I can do realtime charts in Superset over Druid?
I can select last day, but then it set the interval to
"2019-06-02T00:00:00+00:00/2019-06-03T00:00:00+00:00".
Meaning from last day 00:00 to today 00:00, so I'm missing all current day data.
If I select last hour it set the interval to "2019-06-02T23:00:00+00:00/2019-06-03T00:00:00+00:00".
Again it takes the hour from 23 to midnight.
When checking "next hour" or "next day", it again calculates everything relative to 00:00.
I wish to see an ongoing chart on real-time data, last our or last day.
How can I achieve this?
Found the trick, need to select from "today" to "tomorrow":

Google Sheets: Automatically Increment Date by 1 Month

I am currently using a budget sheet that automatically updates date cells to the next "payment" date for a bill. As an example:
=VALUE("2019-03-08")+14*FLOOR((NOW()-VALUE("2019-03-08"))/14)
The cell starts with a date and it then updates every 14 days to the new date. This shows me a cell that has the date of the biweekly payment that is due. In the above example, the cell shows the value of "2019-03-08" until 2 weeks have passed. Once 14 days have passed, the cell will automatically upload to "2019-03-22". This automation will continue forever in 14-day increments. The date displayed in the cell will always update automatically to the next 14-day date. This helps me display the exact due date of a biweekly payment without updating the cell.
I want to do the same thing for a monthly payment, but using a day count of 30 is not very accurate. Is there a way to modify this method to let me update the date automatically to the 24th of the month, every month, on that day. So I start with 2/24/2019 and when 3/24/2019 hits, the cell updates to that date, and so on. The reason this is not accurate is that the months are not all 30 day periods. February is 28 days and some are 31 days. I want the cell to increment in 1 month periods in the same way that the above formula updates in 14-day increments. As an example: The date will display "2/24/2019" until the same day on the next month occurs, then the cell will update to "3/24/2019". This process will continue forever with 4/24/2019, 5/24/2019, etc. It will continue with the year as well, so 12/24/2019 will change automatically to 01/24/2020.
UPDATE: Updated the description with examples of how the behavior works and what I am looking for...
It's much simpler than this. Use the EDATE function (e.g.):
=EDATE(A1,1)
Where A1 is your starting date and 1 is the number of months you which to increment by. See https://support.google.com/docs/answer/3092974?hl=en for more details.
this formula will increase the month every 24th and accounts for year change as well
=IF(DAY(TODAY())>=24,
DATE(YEAR(TODAY()), MONTH(TODAY())+1, 24),
DATE(YEAR(TODAY()), MONTH(TODAY()), 24))
paste where you need and drag down:
=VALUE("2019-"&ROW(A3)&"-08")+14*FLOOR((NOW()-VALUE("2019-"&ROW(A3)&"-08"))/14)

Select DISTINCT dates with hour segmentation

I have a table with counters from a machine.
timestamp, input, ouput.
I need to get the input and output which happened at the start and end of a session.
A session is a different day BUT it starts at 6:00 a.m and ends at 6 a.m next day.
I use to do DISTINCT(DATE(timestamp)) to get the different days, BUT it does not cover the part wich happens next day AND covers the previous day data till 6:00 am.
How can I group by "sessions"?
Shift the time for grouping purposes:
DISTINCT(DATE(timestamp - INTERVAL '6' HOUR))

Creating Dynamic Date Column Headings in Cross Tab for Business Objects

BO Version: 12.1.0 on Infoview,
O/S: W7
I am creating a report in infoview, which is a cross-tab. I have departments on the row side and for the column I want to have all Saturday dates dynamically displayed, and this is dependent on the date prompt values I put in to the report when I run it.
So if I put in for the prompts Dec the 08th 2013 to Jan the 04th 2014 I should see 4 Saturday dates (14th/21st/28th/04th) along the column headers.
I started off using a variable and using the function relativedate, which gave me all the dates I wanted:
=RelativeDate(LastDayOfWeek([Query 1].[Episode End Date]);-1)
but because I used -1 to get the Saturday date it was giving me the Saturday before the earliest prompt date, so I was getting these dates instead:
(07th/14th/21st/28th/04th)
Is there a way I can get these dates but ignore the previous day (the 7th) before the start prompt date?
I want to have this dynamic so that if I put a date range in it shows me all the saturday dates within that range along the top of the report regardless of the date range period.
Andrew
The reason you're having trouble is that WebI (being ISO compliant) considers a week to run from Monday to Sunday, but your reporting week ends on Saturday.
So, I would approach it this way:
=RelativeDate(
LastDayOfWeek(
RelativeDate([Query 1].[Episode End Date];1)
)
;-1)
If we evaluate some dates with this logic, we'll see the desired result:
Testing 12/8 (Sunday):
Add one day = 12/9
Get Last Day Of Week = 12/15
Subtract one day = 12/14
Testing 12/12 (Thursday)
Add one day = 12/13
Get Last Day Of Week = 12/15
Subtract one day = 12/14
Testing 12/14 (Saturday)
Add one day = 12/15
Get Last Day Of Week = 12/15
Subtract one day = 12/14
I'm at home and don't have access to WebI right now, so I can't test this myself, but the logic should be sound.