Forum Discussion
Is it possible to split rows
- 8 years ago
You can do it in Power Query as illustrated in the video and resulting in the query code below.
Basically Power Query takes care of the steps to have your data properly structured into the datamodel, after which DAX takes over for further modeling and adding measures.
So in my view this should be done in Power Query, but I must admit I'm pretty biased towards Power Query.
Many people out here would prefer DAX.
The query code that was generated during video recording:
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Custom", (ThisRow) => if ThisRow[Name] = "John" then List.Transform({1..Parameter_x},each ThisRow[Indicator]/Parameter_x) else {ThisRow[Indicator]}, type {number}), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"), #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Indicator"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "Indicator"}}) in #"Renamed Columns"
You can do it in Power Query as illustrated in the video and resulting in the query code below.
Basically Power Query takes care of the steps to have your data properly structured into the datamodel, after which DAX takes over for further modeling and adding measures.
So in my view this should be done in Power Query, but I must admit I'm pretty biased towards Power Query.
Many people out here would prefer DAX.
The query code that was generated during video recording:
let
Source = Table1,
#"Added Custom" = Table.AddColumn(Source, "Custom", (ThisRow) => if ThisRow[Name] = "John" then List.Transform({1..Parameter_x},each ThisRow[Indicator]/Parameter_x) else {ThisRow[Indicator]}, type {number}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Indicator"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "Indicator"}})
in
#"Renamed Columns"I have a similar question is it possible to split the rows based on the value in the indicator. Like John - 30 this row should split into 30 rows