将所有列附加到 DAX 中的一列中?
append all the columns into one column in DAX?
我有一个带有单一日期索引的大型数据集,我需要使用相同的日期索引将所有列附加到一个列中。
我在一个普通的 excel 文件中,其中包含 power query / dax(无 Power Bi)。
示例:
index
Col 1
...
Col N
1
A
...
X
2
B
...
Y
3
C
...
Z
想要的结果:
index
Col 1
1
A
2
B
3
C
...
...
1
X
2
Y
3
Z
感谢任何帮助。
谢谢。
对于这些类型的操作,最好使用 Power Query:将此代码粘贴到 Power Query 的编辑器中
let
Source = Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText (
"i45WMlTSUXIE4gilWJ1oJSMgywmII8E8YyDLGYijlGJjAQ==",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ index = _t, #"Col 1" = _t, #"Col N" = _t ]
),
#"Changed Type" = Table.TransformColumnTypes (
Source,
{ { "index", Int64.Type }, { "Col 1", type text }, { "Col N", type text } }
),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns (
#"Changed Type",
{ "index" },
"Attribute",
"Value"
)
in
#"Unpivoted Other Columns"
但要在 DAX 中执行相同操作,请使用:
Table =
GENERATE (
DISTINCT ( Atlahua[index] ),
UNION (
CALCULATETABLE ( DISTINCT ( Atlahua[Col 1] ) ),
CALCULATETABLE ( DISTINCT ( Atlahua[Col N] ) )
)
)
我有一个带有单一日期索引的大型数据集,我需要使用相同的日期索引将所有列附加到一个列中。
我在一个普通的 excel 文件中,其中包含 power query / dax(无 Power Bi)。
示例:
index | Col 1 | ... | Col N |
---|---|---|---|
1 | A | ... | X |
2 | B | ... | Y |
3 | C | ... | Z |
想要的结果:
index | Col 1 |
---|---|
1 | A |
2 | B |
3 | C |
... | ... |
1 | X |
2 | Y |
3 | Z |
感谢任何帮助。 谢谢。
对于这些类型的操作,最好使用 Power Query:将此代码粘贴到 Power Query 的编辑器中
let
Source = Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText (
"i45WMlTSUXIE4gilWJ1oJSMgywmII8E8YyDLGYijlGJjAQ==",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ index = _t, #"Col 1" = _t, #"Col N" = _t ]
),
#"Changed Type" = Table.TransformColumnTypes (
Source,
{ { "index", Int64.Type }, { "Col 1", type text }, { "Col N", type text } }
),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns (
#"Changed Type",
{ "index" },
"Attribute",
"Value"
)
in
#"Unpivoted Other Columns"
但要在 DAX 中执行相同操作,请使用:
Table =
GENERATE (
DISTINCT ( Atlahua[index] ),
UNION (
CALCULATETABLE ( DISTINCT ( Atlahua[Col 1] ) ),
CALCULATETABLE ( DISTINCT ( Atlahua[Col N] ) )
)
)