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 ...
- 6 years agoDon't think you can extract Column Names in separate table using DAX. May be someone else be able to help.
AnkitBI
6 years agoSolution 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.
- Mechi6 years agoHelper I
AnkitBI , Thanks for the Code
But i needs to create this table outside of Edit Query, Would be great help if i can able to do this in Modelling --> New Table using DAX formulas
BR
Mechi 🔧
- AnkitBI6 years agoSolution SageDon't think you can extract Column Names in separate table using DAX. May be someone else be able to help.
- v-joesh-msft6 years agoSolution Sage
Hi Mechi ,
Currently, using DAX to extract column headers is not possible, you need to use M Query.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.