Forum Discussion
LUCASM
Helper IV
6 years agoCreate 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 ...
- 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))
LUCASM
Helper IV
6 years agoHi Greg_Deckler
Is this for Power BI or Power Query - (or both)
as you dropped in a pbix file
I need this to be added to PowerQuery (get and transform in Excel)
Maybe the two are synonymouos but as written it ios not recognised by PowerQuery in Excel as a Custom Column
Greg_Deckler
Community Champion
6 years agoHere 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))- LUCASM6 years ago
Helper IV
Thats awesome. I now know why I didnt have a snowballs chance of resolving that on my own.
many many thanks