Forum Discussion
Mechi
6 years agoHelper I
Create New table based on the selected existing table column headers
Hello,
I need a small help in creating new tables based on the column headers of existing table
For example if i have the following existing table
| Number | T1 | T2 | T3 | Avl |
| 5645 | X | X | Y | |
| 3241 | X | X | Y | |
| 7592 | N | |||
| 1643 | X | Y | ||
| 2549 | X | Y | ||
| 4759 | N | |||
| 6247 | X | X | Y | |
| 8713 | X | Y | ||
| 9437 | X | N |
I need a new table with the selected column headers from the existing table as follows
| T_ID |
| T1 |
| T2 |
| T3 |
BR
Mechi 🔧
- Don't think you can extract Column Names in separate table using DAX. May be someone else be able to help.
4 Replies
- AnkitBISolution Sage
Mechi Try Below
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zc3BCcAwCIXhXTznEn1qs0TPLSH7r9HQFG0pRIQP+dM7qUGp0DHnWSeN0kkYNS3dtfHy9fZbq0GC8pgVLePBmJF/wxj++i6uN6+S4eAG8Q/PyrgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Number = _t, T1 = _t, T2 = _t, T3 = _t, Avl = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}, {"T1", type text}, {"T2", type text}, {"T3", type text}, {"Avl", type text}}), Custom1 = List.Select(Table.ColumnNames(#"Changed Type"),each Text.StartsWith(_,"T")), #"Converted to Table" = Table.FromList(Custom1, Splitter.SplitByNothing(), null, null, ExtraValues.Error) in #"Converted to Table"Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.- AnkitBISolution SageDon't think you can extract Column Names in separate table using DAX. May be someone else be able to help.