Reputation: 971
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?
Upvotes: 1
Views: 20159
Reputation: 98
You could also create a column
and do this:
Column = if(MONTH('Date'[Date])=Month(NOW()), "Current Month", "Other")
Upvotes: 0
Reputation: 7891
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")
Upvotes: 1