Forum Discussion
Change Sequenced data to Columns
Thank you! This syntax is almost exactly what I need. How would I incorporate the change of the source to a sql. database and schema? Like the below?
Source = Sql.Database("SERVERNAME", "DATABASE NAME"),
Roadmap_AppTargetPlatform = Source{[Schema="Roadmap",Item="AppTargetPlatform"]}[Data],
let
Source = Sql.Database("SERVERNAME", "DATABASE NAME"),
Roadmap_AppTargetPlatform = Source{[Schema="Roadmap",Item="AppTargetPlatform"]}[Data],
#"Change Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Platform", type text}, {"Platform Sequence", type text}}),
AddColumnName = Table.AddColumn(#"Change Type", "ColumnName", each "Platform " & [Platform Sequence]),
DeleteColumns = Table.RemoveColumns(AddColumnName,{"Platform Sequence"}),
Table.Pivot = Table.Pivot(DeleteColumns, List.Distinct(DeleteColumns[ColumnName]), "ColumnName", "Platform")
in
Table.Pivot- bblackwell33 years agoHelper II
I created a new table using the above syntax and altered it to include my actual column names into the syntax below
let
Source = Sql.Database("LOUSQLWTS711", "AppJourneyTrackingDB_Dev"),
Roadmap_AppTargetPlatform = Source{[Schema="Roadmap",Item="AppTargetPlatform"]}[Data],
#"Change Type" = Table.TransformColumnTypes(Source,{{"AppId", type text}, {"PlatformName", type text}, {"PlatformSequence", type text}}),
AddColumnName = Table.AddColumn(#"Change Type", "ColumnName", each "PlatformName " & [PlatformSequence]),
DeleteColumns = Table.RemoveColumns(AddColumnName,{"PlatformSequence"}),
Table.Pivot = Table.Pivot(DeleteColumns, List.Distinct(DeleteColumns[ColumnName]), "ColumnName", "PlatformName")
in
Table.PivotHowever, I get an error?
- bolfri3 years agoSolution Sage
It seems that in your table there is no AppId column. 🙂
- bblackwell33 years agoHelper II
I thought the same 😄 initially. This is the table I am basing it off of and it has AppId. I also get the error when changing to ID or Id??
Should I create a blank query for the syntax or create table?