如何在 Power Bi 中将毫秒转换为 DateTime?

时间:2021-01-23 15:51:36

标签: timestamp powerbi unix-timestamp powerbi-desktop

我有一个包含 13 位时间戳(我相信是毫秒)的表,但由于某种原因我无法在 Power Bi 中转换它们。我已经在网上查看了许多方法,它应该可以工作,但是每次尝试转换时我都会收到错误消息。 (这是来自转换数据和添加自定义列之后)

enter image description here

当我尝试将“创建”列中的时间戳转换为新的自定义列时,出现错误。这是我在创建新列时使用的公式。

#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [Created]/1000)

这显然适用于有同样问题的其他人,但不适用于我,我不确定为什么会这样,我只是不断收到错误。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

问题很可能是您的 iris.som$grid$pts # x y # [1,] 1.5 0.8660254 # [2,] 2.5 0.8660254 # [3,] 3.5 0.8660254 # [4,] 4.5 0.8660254 # [5,] 5.5 0.8660254 # up to [100,] 10.0 8.6602540 # Assign a name for each coordinate. For example, "1", "2", "3", etc dimnames(iris.som$grid$pts) = list(as.character(1:100), c("x","y")) #iris.som$grid$pts # x y #1 1.5 0.8660254 #2 2.5 0.8660254 #3 3.5 0.8660254 #4 4.5 0.8660254 #5 5.5 0.8660254 # Put the names on the plot text(iris.som$grid$pts, dimnames(iris.som$grid$pts[[1]])) # Do the same steps for other plots plot(iris.som, type="dist.neighbours", palette.name=grey.colors, shape = "straight") text(iris.som$grid$pts, dimnames(iris.som$grid$pts[[1]])) 列被格式化为文本。

在编写尝试除以 1000 的自定义列之前,尝试将该列转换为数字类型。