Extracting day in a new field from a date in Pentaho - kettle

I have a field with a date in yyyy-MM-dd format, I want to extract the day only, for example, if the date is 2014-01-25, I want to have "25" in a new field. I used step "Calculator" is calculation "day of month of date A" but I get 1970-01-01 01:00:00 for all records.
Could someone tell me what might be the reason?

Before you actually have the Calculator step, have a Select Values step and make sure the date field is Date by explicitly giving the Date data type and specify the format it is currently in.

Related

Power BI text to date in "mmm-yy" format

I have an excel file having a column with Text format values like Jan-18, Dec-19, Feb-20. I want to convert it to a date format but when I am trying to make this column a date format it printing 1/18/2021, 12/19/2021,2/20/2021. Basically its considering Jan as month(1), 18 as Date, & making all year as 2021 deafult.
Can someone help?
Original(text) After Date conversion Desired format
Jan-18 1/18/2021 01/01/2018
Feb-19 2/19/2021 01/02/2019
Mar-20 3/20/2021 01/03/2020
You can try,
DATE(2018, MONTH(convertedDate), 1)
This will convert your converted date to the first day of the relevant month in 2018. This is stored in Power BI as a datetime object. If you want to show that value in dd/MM/yyyy format you can do it by selecting correct Format in the top menu.
If you load in the Original column as text, try this trick:
Desired format = DATEVALUE ( "1-" & [Original] )
Appending the "1-" to the beginning gives it a day of the month and forces it to recognize the last digits as the year.
I faced with the same issue , while changing the format instead of using Date use the last option i.e "Using Locale... " -> in that change the Data Type from Text -> Date, and Locale to English(United Kingdom) -> Hit ok. Earlier Format ,What should be the desired format .This worked for me!

Power BI Dax Expression Help - Setting default slicer between dates

Power Bi report uses a date slicer (between) - As a default I want it to set the first date in the slicer as Monday (last week) and the last date as Friday (last week). I dont want this to be a relative date but always must be the previous Mon-Fri. I have a column in my data set that tells me which one is the 'Previous Week' as a text field. I dont know how to use this to set a default slicer value. But i also want to make sure the user can change the slicer dates and it changes as per the user request.
Example today is 01/09/2020
I want my default slicer date as : 24/08/2020 - 28/08/2020
I have two measures which gives me by last week dates:
DefaultSD = MINX( FILTER(Data, [WeeksFilter] = "Previous Week Only"),[Date])
DefaultED = MAXX( FILTER(Data, [WeeksFilter] = "Previous Week Only"),[Date])
I assume this is possible using a DAX expression but dont know how to create this expression to populate these default values.
Please note the data is refreshed up until 01/09/2020 so there is currently data for this week but i dont want this to included in the default slicer on report load
You can't set slicer defaults yet but this can be achieved with relative date filtering.
Select date in the last 1 calendar week:

How do I format text column with year to date format in Power BI

See Attached Image. I imported data with a date column (red area). I realized I needed to change it to date format so I created a new column and entered the formula (blue area) to change the column to a date format, however if you look at the green area, the year is not lining up starting from 2013. How can I fix this? Also my data points are annual so I don't need the "day", "month" format, I just want the year if possible.
This formula is trying to parse textual representation of a date, while here you have the year part only. Also, parsing is unnecessary complicated for your case. Just use DATE function to construct a date from parts, like this:
dateFormatted = DATE([Calendar Year], 1, 1)
Which should give you January 1st date in each year (which I guess is the desired result):

Start Date should be todays date and end date should be todays date plus one month

I have a requirement, Ii have date slicer i have created the date dimension
Start Date = CALENDAR (DATE ( 1900,1, 1), DATE (2025,12, 31))
Now I have kept the slicer for this it shows like this 1/1/1900 - 12/31/2025
but the end user want to see the start date with default todays date i.e. 01/02/2019 start date & end date.JPG
and end date should show as 02/02/2019 instead of 12/31/2025.
Can anybody suggest me how can I approach this requirement?
Not quite sure what you're after.
If you're asking for to set a default value for a slicer, that's not possible yet. Upvote this at: Slicer default selected values
Also, when you're using DATES, please use the right syntax, for example:
dd.MM.yyyy
yyyy.MM.dd
Other relevant information that could solve what I think you're after: https://www.fourmoo.com/2017/10/03/power-bi-did-you-know-all-power-bi-services-servers-are-in-utc-now-how-to-handle-it-for-dates-times/

previous sunday date in informatica

I've a requirement where I need to compare a column date with current date. If my column date > last sunday's date I need to populate a status. Here, am facing issues in calculating present week's sunday date.
I need to calculate Previous Sunday's date in Informatica expression transformation.
I am not exactly sure about your requirement, however, you can always get the day and based on that subtract a fixed number of days to reach any sunday you want (present week or previous week). You should have a limited (7) set of IIF statements to achieve this.
Eg. If the day is 'Tuesday' (day of the current date) then subtract 2 from the date to get sunday date!
You can write an expression as- trunc(sysdate,'d') in a variable port which is having datatype as date.
The expression would return the Sunday date of the current date. Then you can compare the two dates (your column date and the variable port date) and populate the status.
If you just want to verify the result of the expression trunc(sysdate,'d') you can fire the following query in the oracle db:
"select trunc(sysdate,'d') from dual"
result returned would be the latest Sunday date.