BIDS\SSIS Derived day of week from date - date

I need to derive a column to be imported from CSV to ms sql. I have a date field, but I also need a day of week field, represented numerically. for example monday would be 2. Is there a way to do that as an expression in "Derived Column Transformation Editor", similar to the Weekday() function in excel?

If by 'BIDS' you mean 'SSIS', I believe you are looking for the DATEPART() function: you can extract the day number using DATEPART("DW",[MyDateField]). This will return 1 for Monday, 2 for Tuesday ... 7 for Sunday.
Link with additional info

Related

Dates in google sheets

I am very new at all of this, and I don't know if what I want to do is even possible, but I'm hoping someone can assist me with some formulas if it is.
I am trying to create a spreadsheet for my business's scheduling purposes. I have created a spreadsheet that lists my PO's, start date, end date, location, project hours, and total days.
I currently have a couple formulas on the sheet. When I enter the project hours in column e the formula =roundup(E2/24) inputs the expected total days of work into column f.
I have a starting date of 7/1/2022 entered in b2 then have a formula that looks at column c (end date) and adds the amount of days from column f (total days) to the end date. Each line there after copies the end date from the row above to the start date and then adds the total days from f to that to complete the next row.
What I would like to do is have the dates only reflect workdays (M-F) instead of returning all dates. Is this even possible?
Take a look at spreadsheet example, but it is pretty basic.
Thank you in advance for any help you can provide!
I understand that you want to add "Total days" to the "Start Date" to get the "End Date" excluding weekends, in this case Sundays and Saturdays.
Paste this formula in cell C2 "End Date" column.
=ArrayFormula(IF(E2:E="",,WORKDAY.INTL(B2:B,F2:F,"0000011",)))
Breakdown:
1 - ArrayFormula output's values into several rows and/or columns, and to make the formula dynamic.
2 - WORKDAY.INTL determines the date after a certain number of workdays, excluding certain number of weekends and holidays.
3 - [weekend] argument using string method of ones and zeros "0000011" to specify workdays and weekends, 0 workday, 1 weekends starting from Monday to Sunday.
here is the link to the spreadsheet, hope that answerd your question.

PowerBI Matrix with Year and Month

In the matrix below I have data from Jan 2020-Jan 2021, where the Jan column has the data from both 2021 and 2021. Is there any way to have the matrix add another column for Jan 2021 instead of aggregating that in with the Jan 2020 data?
Chose Year and Month in the date hierarchy column and then in the matrix click "expand all down one level in the hierarchy.
I am new to Power BI and I was wondering recently myself about something similar.
You can create a new column (text format) and combine month and year.
Date
Date Modified
dd-MM-yyyy
yyyy-MM
or
Date
Date Modified
dd-MM-yyyy
yyyy-MM (MMMM)
or
Date
Date Modified
dd-MM-yyyy
yyyy-MM (MMM)
It is not the most elegant solution, it changes a bit what is displayed (not simply months in the headers), it has a few disadvantages but it works.
I would be curious myself whether a better solution exists.
If you click on the date column you are using [InvoiceDate] and select the date option, it will separate out the two date values.
currently it is in a hierarchy showing just the month values but not the actual date
i have this but mine stays summed up at the year level even though the 'month' is expanded under the TimeByDay...
If I take out the year it will provide it like above but combines both... or as is it puts columns in the year

Fetching the 15th last working day date-yyyyMMdd (excluding only weekends) in Hive

I have a table with date column (date in string format yyyyMMdd). My requirement is to design a logic to fetch data from the table where "date column value equals to the date of the 15th previous working day" (excluding only Saturdays and Sundays) without using a UDF or a shell script. For example it is 21st Feb 2020 today; the logic should produce an output: 20200203.
Assuming you actually mean the 14th previous working day based on your example, and you are ignoring holidays, it is just a date_sub function with a case statement for day of the week.
case from_unixtime(unix_timestamp(event_date,'yyyyMMdd'),'u')
when 1 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),20),'-','')
when 2 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),20),'-','')
when 3 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),20),'-','')
when 4 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),20),'-','')
when 5 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),18),'-','')
when 6 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),18),'-','')
when 7 then regexp_replace(date_sub(from_unixtime(unix_timestamp(event_dt,'yyyymmdd' )),19),'-','')
end as new_date
This assumes Sat/Sun should be treated like Monday,
If Sat/Sun should be like Friday then make then use 19, 20.
If you need to account for holidays, then you need to create a calendar table with every day, and note which days are holidays, and then it is a join to the table and a some more logic that could be figured out if this is the case.

Convert date to Julian in SharePoint Column to show YYYYMonth (spelled out)DD - 2018June15

I want to set a sharepoint 2016 column to calculate a date that will render, for example, 2018June15. What is the formula for that? I'm not an excel formula expert or SharePoint expert. I'm just looking for a formula.
Please find the below 2 examples and the description.
23-Feb-2017
=TEXT(WEEKDAY([Column1]), "dddd")
Calculates the day of the week for the date and returns the full name of the day (Monday)
2-Jan-2003
=TEXT(WEEKDAY([Column1]), "ddd")
Calculates the day of the week for the date and returns the abbreviated name of the day (Thu)

How to do dynamic date range iteration in Talend?

I have MinLoginTime and MaxLoginTime stored in 2 globalmap variables:
globalMap.put("MinLoginTime","2017-10-24") //ignore the datetime format, but it a date
globalMap.put("MaxLoginTime","2018-04-26")
I want to put month wise iteration and fetch records. i.e. Here we see there are 7 months in example: 10,11,12,1,2,3,4
I want to generate these kind of dates:
FromDate ToDate
2017-10-01 2017-10-31
2017-11-01 2017-11-30
2017-12-01 2017-12-31
...
2018-04-01 2018-04-30
Then, need to iterate over each of these rows and do something (lets use tLog for now)
Could someone please help as to what Talend components can be used here for generating date ranges, where to store them and how to iterate them to do something?
You can achieve this pretty easily using a combination of Talend components and some Java code. Talend has a good collection of date manipulation functions.
First, store your global variable dates as Date type.
globalMap.put("MinLoginTime", TalendDate.parseDate("yyyy-MM-dd", "2017-10-24"))
Then tLoop_1 loops on all the months between your min and max dates. This code gets the number of months between the 2 dates :
TalendDate.diffDate((Date)globalMap.get("MaxLoginTime"),(Date)globalMap.get("MinLoginTime"),"MM")
tJava_3 just stores the date of the current iteration in a CURRENT_DATE global variable. It is the sum of the min date and the current iteration value (from 0 to N months).
globalMap.put("CURRENT_DATE", TalendDate.addDate((Date)globalMap.get("MinLoginTime"), (Integer)globalMap.get("tLoop_1_CURRENT_VALUE"), "MM"))
tFixedFlowInput_1 defines 2 Date columns: FromDate and ToDate in order to get the first and last day of the current iteration's month respectively.
TalendDate.getFirstDayOfMonth((Date)globalMap.get("CURRENT_DATE"))
TalendDate.getLastDayOfMonth((Date)globalMap.get("CURRENT_DATE"))
Check TalendDate class reference for all date manipulation methods.