我有一个包含1列的表。它看起来是这样的:
Column1
https://www.google.com
2019-03-12T11:15:30-05:00
https://www.twitter.com
2019-03-06T11:10:05-06:00
我要做的就是把第二行换成一个新的列。
Column1 Column2
https://www.google.com 2019-03-12T11:15:30-05:00
https://www.twitter.com 2019-03-06T11:10:05-06:00
做这件事最好的方法是什么?我不关心它是在查询编辑器中还是在DAX中,但是在DAX中,列的排序方式不同(在本例中,每个日期都与它上面的链接相关联)。
发布于 2019-03-15 08:40:23
在查询编辑器中,编写一个自定义列,该列查看前几个字符以区分URL和日期。然后在该列上旋转。
编辑:看起来你需要对每一对进行索引才能正确透视,所以添加一个从0开始的索引并除以2得到0,0,1,1,2,2,3,3,...
,它很好地将每一对组合在一起。
let
Source = <Your Source>,
#"Added Custom" = Table.AddColumn(Source, "Custom", each if Text.Start([Column1],1) = "h" then "URL" else "Date"),
#"Added Index" = Table.AddIndexColumn(#"Added Custom", "Index", 0, 1),
#"Integer-Divided Column" = Table.TransformColumns(#"Added Index", {{"Index", each Number.IntegerDivide(_, 2), Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Integer-Divided Column", List.Distinct(#"Integer-Divided Column"[Custom]), "Custom", "Column1")
in
#"Pivoted Column"
https://stackoverflow.com/questions/55173904
复制相似问题