Forum Discussion
Change granularity
- 6 years ago
Good Point this can be handled by creating a custom column , with text . split function . Refer the following M code for your reference .
Reference : https://www.youtube.com/watch?v=9krfJLv8ENk
let
Source = Excel.Workbook(File.Contents("...Documents\Smap.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"tart date", type date}, {"Topic", type text}, {"Candidates", type text}, {"Description", type text}, {"cloud", Int64.Type}, {"probability", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Split Candidates", each Text.Split([Candidates],",")),
#"Expanded Split Candidates" = Table.ExpandListColumn(#"Added Custom", "Split Candidates")
in
#"Expanded Split Candidates"
Hi mitsu, this indeed worked, but isn't future proof. What happen when in future I have 4 possible candidates? then I would have to transform data again and select the 4th column as well?
Good Point this can be handled by creating a custom column , with text . split function . Refer the following M code for your reference .
Reference : https://www.youtube.com/watch?v=9krfJLv8ENk
let
Source = Excel.Workbook(File.Contents("...Documents\Smap.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"tart date", type date}, {"Topic", type text}, {"Candidates", type text}, {"Description", type text}, {"cloud", Int64.Type}, {"probability", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Split Candidates", each Text.Split([Candidates],",")),
#"Expanded Split Candidates" = Table.ExpandListColumn(#"Added Custom", "Split Candidates")
in
#"Expanded Split Candidates"
- Anonymous6 years agoNot applicable
Cool, thanks alot!