【问题标题】:Filter Dates which are NOT in current month using power Query使用 power Query 过滤不在当前月份的日期
【发布时间】:2018-10-04 10:38:57
【问题描述】:

在 power bi 的 查询编辑器 中,我需要将一个日期列拆分为另外两列。一个为“当月”,另一个为“不在当月”

对于“在当前月份”我使用了Date.IsInCurrentMonth,现在我需要对于“不在当前月份”

感谢任何帮助。
泰。

【问题讨论】:

    标签: powerbi powerquery


    【解决方案1】:

    只需使用not

    if not Date.IsInCurrentMonth([Date])
    then "Not in Current Month"
    else "In Current Month"
    

    反之亦然

    if Date.IsInCurrentMonth([Date])
    then "In Current Month"
    else "Not in Current Month"
    

    【讨论】:

      【解决方案2】:

      试试这个对我有用的公式:

      if (Date.Month([Order Date]) = Date.Month(DateTime.Date(DateTime.LocalNow())))
      then "Current Month"
      else "Not Current Month"
      

      【讨论】:

        【解决方案3】:

        我知道这是一篇旧帖子,我做了一些稍微不同的事情,因为我不想给你 IF 语句。

        Logical.ToText(Date.IsInCurrentMonth([PROCESSDATE])) = "false"
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-12-06
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多