How can I have Dynamic Fiscal Date Range in BigQuery? - google-bigquery

Please suggest me how can I change date range dynamically in BigQuery . For example fiscal year 2017 (4-5-4 calendar) had 371 days verses 364 days in fiscal year 2018. I don't want to change this manually every year.
Any help would be appreciated.

You can solve this by creating the source view separately which cab be then joined with the main code. So that, any changes made in the source code will be reflected in the main code and can be reused in multiple programs.
This way you won't have to change the date range manually all the queries.
for more details, please refer dynamic date range in BigQuery

Related

Is there a way to use a variable/combo box to select a year in a date without using date picker

I am working on a calculator to track my (and my coworkers may use it) overtime at work. We have a bunch written in excel, but I am trying to do one in access. There is probably a simple solution, but having searched for a couple days for using a variable in a date has only given me how to use the date as a variable. So our pay periods are defined 1/1/yyyy to 1/15/yyyy etc. Hour pay is calculated on the number of days we have in a pay period which varies every year by days off. I have it calculating the proper number of days using VBA, but I am having difficulty getting it to use the combo box year which defaults to current year.
I have tried setting the control source to = 01/01/[cmbYearselect]
using variables, creating a string in vba and format date
Any help would be appreciated as I am going to have to use the variable in both the control sources and vba code.
Thank you
01/01/[cmbYearSelect] results in 12/30/1899 on my form
everything else has resulted in a type mismatch for the variables etc.
Use CDate with no year:
=CDate(#01/01#)
or:
=CDate("01/01")
to have primo of the current year.

Current month and prevoius month logic in cognos prompt page

I want to designed a report in a cognos which showcase data for current month or prevoius month choice on prompt page, need to get logic for this.
Please advice if any one has solution for this...
2 suggestions
Scenario 1) Put the current month and prior month values in a conditional block
Or if you don't want to do that,
Scenario 2)
Create two lists
One each way you want to present the data
Current Month
Prior Month
Then use rendering on the prompt to show the list the user selected

How to Extend the End Date in a SQL Calendar Table?

I have a report that, according to users, started miscalculating dates in one field in November 2015. After some digging around, I found that one of the tables the field referenced seemed to have an end date on 2015-10-31.
The "D" field seems to represent the day of the week, with Sunday being day 1 and Saturday being 7.
Is there a way to extend the calendar so that it ends further into the future, for example 2049-12-31?
Our calendar table, for a variety of reasons, goes the the end of the current year. We have written a query that adds a new year to this table. This query takes care of most of the fields in that table. It does not touch the holiday field. That is updated manually through a web page.
We send ourselves reminders. Starting in March, we send monthly reminders that we should think about adding another year. After ensuring that the database segment has space, and that none of the definitions, such as fiscal periods, have changed, we run the query that adds a year.
Later in the year we start mailing ourselves reminders about the holidays. Then we check to see if HR has declared them, and if so, update the records accordingly.
This meets our business requirements. Yours will be different of course.

SSRS 2008 R2 calulate new date from existing that's 1 year later and on Monday?

hoping someone can help. I have an textbox on a report that I need to calculate a new date value for from another date on the report.
I need to take an existing shipping date (say 5/5/2014) and calculate a new date which is one year later but on the Monday of that week (so would be 5/4/2015) -- we only ship product on Mondays.
I know I need to use DateAdd and probably DatePart but have been unable to find the proper formula.
can anyone help?
figured it out -- thanks for all the help. I took the idea that Gordon had, putting it in my select statement rather than trying to manipulate it in the expression area of the textbox on the report:`SELECT DATEADD(wk,DATEDIFF(wk,0,DATEADD(YY,1,o.REQ_DATE)),0) as NewDate'
works great! :)

How do I automate a report on variance in the same SQL table fields on monthly basis?

I have a T-SQL view with integer fields. I need a report on a monthly basis regarding the difference from one month to the next, i.e. so many people were engaged in a particular activity on 8am of the 1st of this month, so many the previous month, here is the difference. The numbers fluctuate all the time. I need a variance between 2 snapshots in time.
I am using the SSRS, however in reporting services I can only display the "current" situation. I could run a report at 8am of the 1st of each month and then calculate the differences manually. But how could I automate this calculation and then report on the difference?
I have tried to import data from SQL to 1 Excel spreadsheet from 1 month, then to the 2nd spreadsheet from the 2nd month. The 3rd spreadsheet calculates the difference. But how do I create a nice looking report from Excel?
Additionally I cannot send the report by email. It has to be available online.
Furthermore, each office wants their figures to be confidential and not visible to another office.
Thanx in advance.
Can you add a UserCount table that stores each office's user count for each month? It could have columns like:
id
date
user_count
office_id
You would insert a new row each month based on what the view tells you that month for each office. Then it's as simple as exporting that table to Excel and graphing it using Excel's built-in graphing tools.