在电源查询中使用大于和小于时间戳
using greater than and lesser than with timestamps in power query
我需要检查时间戳是小于下限时间戳还是大于上限时间戳。我目前的公式是这样的:
= Table.AddColumn(#"Changed Type2", "Correct location", each if ([Time]) < ([Active from]) or ([Time]) > ([Active to]) then "No" else "Yes")
这给我错误 "We cannot apply operator < to types Date and DateTime"
为了解决这个问题,我尝试使用
= Table.AddColumn(#"Changed Type2", "Correct date", each if #date([Time]) < #date([Active from]) or #date([Time]) > #date([Active to]) then "No" else "Yes")
但是我相信#date 函数希望我给它三个变量,即(日、月、年),它不能从给定的字段中提取。
谁能告诉我我要去哪里wrong/what正确的函数是?我怀疑我需要提取日、月、年数据,然后使用 #date 函数,但我不确定。
我会检查上一步的数据类型 - 两列之一必须是 日期,而不是 Date/Time。您可以使用右键单击日期列上的 更改类型 子菜单将其更改为 Date/Time.
我需要检查时间戳是小于下限时间戳还是大于上限时间戳。我目前的公式是这样的:
= Table.AddColumn(#"Changed Type2", "Correct location", each if ([Time]) < ([Active from]) or ([Time]) > ([Active to]) then "No" else "Yes")
这给我错误 "We cannot apply operator < to types Date and DateTime"
为了解决这个问题,我尝试使用
= Table.AddColumn(#"Changed Type2", "Correct date", each if #date([Time]) < #date([Active from]) or #date([Time]) > #date([Active to]) then "No" else "Yes")
但是我相信#date 函数希望我给它三个变量,即(日、月、年),它不能从给定的字段中提取。
谁能告诉我我要去哪里wrong/what正确的函数是?我怀疑我需要提取日、月、年数据,然后使用 #date 函数,但我不确定。
我会检查上一步的数据类型 - 两列之一必须是 日期,而不是 Date/Time。您可以使用右键单击日期列上的 更改类型 子菜单将其更改为 Date/Time.