使用 DirectQuery 将时间戳转换为 DAX 中的日期

Convert timestamp to date in DAX with DirectQuery

我想将 Timestamp 列转换为 table 中的日期列。我尝试使用 DAX 创建一个度量:

Date = FORMAT('my_table'[Timestamp], "dd/mm/yyyy")*1

并发现错误:

A single value for column 'Timestamp' in table 'my_table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

但我这里不需要聚合,我只需要将日期时间转换为日期。

时间戳列如下所示:


尝试过:

Date = FORMAT(MIN('my_table'[Timestamp]), "dd/mm/yyyy")*1

这给出了一个奇怪的日期格式,因为我试图使用“显示为 table”来检查视觉对象:

你能试试下面这个吗测量-

Date = FORMAT(MIN('my_table'[Timestamp]), "dd/mm/yyyy")*1

创建一个计算列而不是度量

您可以简单地复制时间戳列,然后将列数据类型更改为日期。

Date = 'my_table'[Timestamp]