Forum Discussion

LUCASM's avatar
LUCASM
Helper IV
6 years ago
Solved

Create a date calculation

I need to create an if the else statement based on the following rules and am pulling my hair out. This should be fairly simple so why I cant fathom it out is beyound me at the moment.   The rule ...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Here is the Power Query code, same logic as the DAX code and the DAX is prettier...

     

    = Table.AddColumn(#"Changed Type", "Custom", each let
      Year = Date.Year(DateTime.Date([Date])),
      Month = Date.Month(DateTime.Date([Date])),
      Day = Date.Day(DateTime.Date([Date]))
    in
     if (Day >= 26) and (Month = 12) then #date(Year+1,1,26) else if (Day >= 26) then #date(Year,Month+1,26) else #date(Year,Month,26))