Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Older than 3 months M language

Hey all. I need help translating the below. Basically, need to flag rows where 'Last update' was more than months from now.

I have DAX for that:

Update =
IF (
Table[Last update]
< DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 3, DAY ( TODAY () ) ),
"!",
""
)
  • Given that a "Month" is not a precise measurement, this should get you close:

     

       #"Added Custom" = Table.AddColumn(Source, "Custom", each 
              let 
                   today=DateTime.LocalNow(),
                   yr = Date.Year(today),
                   mnth = Date.Month(today),
                   dy = Date.Day(today),
                   prev= #date(yr, mnth-3,dy)
              in 
                   if [Last update] < prev then "!" else "",
                   type text)

1 Reply

  • Given that a "Month" is not a precise measurement, this should get you close:

     

       #"Added Custom" = Table.AddColumn(Source, "Custom", each 
              let 
                   today=DateTime.LocalNow(),
                   yr = Date.Year(today),
                   mnth = Date.Month(today),
                   dy = Date.Day(today),
                   prev= #date(yr, mnth-3,dy)
              in 
                   if [Last update] < prev then "!" else "",
                   type text)