如何按两列筛选 table
How to filter table by two columns
我有以下 table:
ID
TEST_ID
Component
ComponentInfo
1
5
Test 1
Info
2
5
Test 1
AB 2
3
5
Test 1
XY
4
5
Test X
Info 2
5
5
Test X
Info 1
6
5
Test Y
Info 2
7
6
Test 1
Info 2
8
7
ABC
Info 1
9
8
XYZ
Info 2
9
9
XYZ
Info 2
我想获得以下输出:
TEST_ID
Component
5
Test 1
5
Test X
5
Test Y
6
Test 1
7
ABC
8
XYZ
9
XYZ
我觉得如果能在数据转换部分实现就好了。我该怎么做?
我在你的“问题”中没有看到任何过滤;相反,删除冗余列并保留唯一值。
M语言声明:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIF4pDU4hIFEMczLy1fKVYnWskIXcbRScEILGOMLhMRCRY3QRaPgJoF1WOKVc4QLGeGLBeJqs8cyDVDdx9UzgLINQc7zBnVQEsg1wLsrihUHSAJSwyJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, TEST_ID = _t, Component = _t, ComponentInfo = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"TEST_ID", Int64.Type}, {"Component", type text}, {"ComponentInfo", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"ID", "ComponentInfo"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
#"Removed Duplicates"
按 strg select TEST_ID 和组件,右键单击然后删除重复项
= Table.Distinct(#"更改类型", {"TEST_ID", "组件"})
这就是我需要的! :-)
我有以下 table:
ID | TEST_ID | Component | ComponentInfo |
---|---|---|---|
1 | 5 | Test 1 | Info |
2 | 5 | Test 1 | AB 2 |
3 | 5 | Test 1 | XY |
4 | 5 | Test X | Info 2 |
5 | 5 | Test X | Info 1 |
6 | 5 | Test Y | Info 2 |
7 | 6 | Test 1 | Info 2 |
8 | 7 | ABC | Info 1 |
9 | 8 | XYZ | Info 2 |
9 | 9 | XYZ | Info 2 |
我想获得以下输出:
TEST_ID | Component |
---|---|
5 | Test 1 |
5 | Test X |
5 | Test Y |
6 | Test 1 |
7 | ABC |
8 | XYZ |
9 | XYZ |
我觉得如果能在数据转换部分实现就好了。我该怎么做?
我在你的“问题”中没有看到任何过滤;相反,删除冗余列并保留唯一值。
M语言声明:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIF4pDU4hIFEMczLy1fKVYnWskIXcbRScEILGOMLhMRCRY3QRaPgJoF1WOKVc4QLGeGLBeJqs8cyDVDdx9UzgLINQc7zBnVQEsg1wLsrihUHSAJSwyJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, TEST_ID = _t, Component = _t, ComponentInfo = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"TEST_ID", Int64.Type}, {"Component", type text}, {"ComponentInfo", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"ID", "ComponentInfo"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
#"Removed Duplicates"
按 strg select TEST_ID 和组件,右键单击然后删除重复项
= Table.Distinct(#"更改类型", {"TEST_ID", "组件"})
这就是我需要的! :-)