1

I'm trying to add a custom column in power bi by this query:

= Table.AddColumn(#"Filtered Rows", "IsCurrentMonth",  if(Date.Month([Timestamp])=Date.Month(NOW())) then "Current Month" else "Other")

but the result is:

Expression.Error: The name 'NOW' wasn't recognized.  Make sure it's spelled correctly.

so how can I get the current month?

Olly
  • 7,749
  • 1
  • 19
  • 38
TheGeeky
  • 962
  • 1
  • 12
  • 34

2 Answers2

1

The function you need is DateTime.LocalNow

So your query step becomes:

= Table.AddColumn(#"Filtered Rows", "IsCurrentMonth",  if(Date.Month([Timestamp])=Date.Month(DateTime.LocalNow())) then "Current Month" else "Other")
Olly
  • 7,749
  • 1
  • 19
  • 38
0

You could also create a column

enter image description here

and do this:

Column = if(MONTH('Date'[Date])=Month(NOW()), "Current Month", "Other")
ainsighta
  • 98
  • 7