我正在尝试通过此查询在power bi中添加自定义列:
= Table.AddColumn(#"Filtered Rows", "IsCurrentMonth", if(Date.Month([Timestamp])=Date.Month(NOW())) then "Current Month" else "Other")
但结果是:
Expression.Error: The name 'NOW' wasn't recognized. Make sure it's spelled correctly.
那我怎么得到当前月份?
答案 0 :(得分:1)
您需要的功能是DateTime.LocalNow
因此您的查询步骤变为:
= Table.AddColumn(#"Filtered Rows", "IsCurrentMonth", if(Date.Month([Timestamp])=Date.Month(DateTime.LocalNow())) then "Current Month" else "Other")
答案 1 :(得分:0)