Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Mechi
Helper I
Helper 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

NumberT1T2T3Avl
5645X XY
3241 XXY
7592   N
1643  XY
2549X  Y
4759   N
6247XX 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 🔧

1 ACCEPTED SOLUTION

Don't think you can extract Column Names in separate table using DAX. May be someone else be able to help.

View solution in original post

4 REPLIES 4
AnkitBI
Solution Sage
Solution 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.

@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 🔧

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.

Don't think you can extract Column Names in separate table using DAX. May be someone else be able to help.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.