Hello!
I try to find a way to get the number of days between Today’s date and the first day of the year for creating a Calculated Field for a BAQ. If someone could help !
Hello!
I try to find a way to get the number of days between Today’s date and the first day of the year for creating a Calculated Field for a BAQ. If someone could help !
Create a calculated field that has the following defined:
DATEPART(dy,GetDate())
This returns the “Day of Year”
You can also do this if you’re looking between dates:
DATEDIFF(dd,datefromparts(Year(GetDate()),1,1),GetDate())+1
Datepart gives me the day of the Month, not the number of days between today and january 1st.
Today, it would give me 2 instead of 121
If you use DD or D in datepart, it would give you 2. If you use DY it will give you day of the year.
It works ! Thanks !