Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
HareshChalla
Regular Visitor

Day number to date

In my data table there is a column which contains dates of every weekend (every Friday, eg: 26 Aug 2022, 02 Sep 2022), another column containing only day number (eg: 22,23,24 ; 29,30,1,2). How do I convert this day column which is in text format into DDMMYYYY date format.

HareshChalla_0-1666856466906.png

Requesting the experts to kindly help me out from this situation. 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Ok, I see what you mean. Try this (I'm assuming that the week date is the end of the week):

 

New date =
VAR _DayInt =
    VALUE ( 'Table'[Day] )
VAR _DayDate =
    DATE ( YEAR ( 'Table'[Week] ), MONTH ( 'Table'[Week] ), _DayInt )
RETURN
    IF (
        _DayDate > 'Table'[Week],
        DATE ( YEAR ( 'Table'[Week] ), MONTH ( 'Table'[Week] ) - 1, _DayInt ),
        _DayDate
    )

 

day from week.jpg

Please confirm that the highlighted rows are the expected result.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
HareshChalla
Regular Visitor

Thank you soo much for your time and effort. Appreciate your skill

PaulDBrown
Community Champion
Community Champion

Ok, I see what you mean. Try this (I'm assuming that the week date is the end of the week):

 

New date =
VAR _DayInt =
    VALUE ( 'Table'[Day] )
VAR _DayDate =
    DATE ( YEAR ( 'Table'[Week] ), MONTH ( 'Table'[Week] ), _DayInt )
RETURN
    IF (
        _DayDate > 'Table'[Week],
        DATE ( YEAR ( 'Table'[Week] ), MONTH ( 'Table'[Week] ) - 1, _DayInt ),
        _DayDate
    )

 

day from week.jpg

Please confirm that the highlighted rows are the expected result.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

If you wish to assign the same month and year as the Week field, try:

 

New date =
DATE ( YEAR ( Table[Week] ), MONTH ( Table[Week] ), VALUE ( Table[Day] ) )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Well, this doesn't solve my issue as the day numbers against the last week of August (eg: 29,30,...) are being shown as last week of September (29-09-2022) instead of that of August(29-08-2022). Is there any other way?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.