Forum Discussion

HareshChalla's avatar
HareshChalla
Regular Visitor
3 years ago
Solved

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 c...
  • PaulDBrown's avatar
    3 years ago

    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
        )
    

     

    Please confirm that the highlighted rows are the expected result.