Forum Discussion
Cross Table to Flat Table
- 9 years ago
Hi sing_ideas,
Based on my test, the "Unpivot Table" option is the easiest and most appropriate solution to flatten a table. When you make any change to Excel File stored in One Drive, including changing data records (edit data values) or changing table structure (add or delete columns), the flat table will be updated automatically.
Alternatively, if you can also achieve the flat table via DAX:
Table = UNION ( SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Food", "Amount", 'CrossTable'[Food] ), SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Shelter", "Amount", 'CrossTable'[Shelter] ), SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Clothing", "Amount", 'CrossTable'[Clothing] ) )
But this new calculated table cannot get the update if you add or delete columns in source file.
Regards,
Yuliana Gu
Hi,
Below are 3 images, CrossTable, Flat Table, Query Editor.
CrossTableFlatTableQueryEditorUnpivot
Hope, I am able to brief it clear with the screen shots.
External resources -
https://www.youtube.com/watch?v=pUXJLzqlEPk
http://nhsexcel.com/excel-pivot-table-crosstab-flat-list/
regards,
Singaravelu S
Hi sing_ideas,
Based on my test, the "Unpivot Table" option is the easiest and most appropriate solution to flatten a table. When you make any change to Excel File stored in One Drive, including changing data records (edit data values) or changing table structure (add or delete columns), the flat table will be updated automatically.
Alternatively, if you can also achieve the flat table via DAX:
Table = UNION ( SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Food", "Amount", 'CrossTable'[Food] ), SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Shelter", "Amount", 'CrossTable'[Shelter] ), SELECTCOLUMNS ( 'CrossTable', "Date", 'CrossTable'[Date], "Type", "Clothing", "Amount", 'CrossTable'[Clothing] ) )
But this new calculated table cannot get the update if you add or delete columns in source file.
Regards,
Yuliana Gu