如何 return powerquery 中两个时间戳之间的值?

How to return values between two timestamps in powerquery?

我正在 Excel 中的 Powerquery 中的两个 UTC 时间戳之间的查询中尝试 return 值,但我无法获得正确的语法,请您指教?

我已经成功地使用以下代码 return 从某个日期开始的任何事情,但这也包括任何后续日期:

#"Filtered Rows" = Table.SelectRows(#"Removed Columns", 
    each [TimestampUTC] >= #datetime(pReadYear, pReadMonth, pReadDay, 0, 0, 0)

所以我修改成下面的....

#"Filtered Rows" = Table.SelectRows(#"Removed Columns", 
    each if [TimestampUTC] >= #datetime(pReadYear, pReadMonth, pReadDay, 0, 0, 0) 
        or [TimestampUTC] <= #datetime(pReadYear, pReadMonth, pReadDay+1, 0, 0, 0))

...但它一直给我一个 "Token Then Expected" 错误。非常感谢所有帮助。

当您使用 if 时,它希望它的形式为:

if <condition> then <condition is true result> else <condition is false result>

我猜你想要的是没有 if.

的简单 and(不是 or
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", 
    each [TimestampUTC] >= #datetime(pReadYear, pReadMonth, pReadDay, 0, 0, 0) 
        and [TimestampUTC] <= #datetime(pReadYear, pReadMonth, pReadDay+1, 0, 0, 0))