The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Dear Community,
can anyone help me, with the transformation below?
I Think it should be possible without programming a loop...
Here is an Example file
Many thanks an regards,
Michael
Solved! Go to Solution.
M Code from Advanced Editor
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{
{"ProductFamily", type text}, {"From", type date}, {"To", type date}, {"ID", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date",
each List.Dates([From],Duration.Days([To]-[From])+1,#duration(1,0,0,0))),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"From", "To"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"ProductFamily", "Date", "ID"}),
#"Expanded Date" = Table.ExpandListColumn(#"Reordered Columns", "Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}})
in
#"Changed Type1"
M Code from Advanced Editor
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{
{"ProductFamily", type text}, {"From", type date}, {"To", type date}, {"ID", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date",
each List.Dates([From],Duration.Days([To]-[From])+1,#duration(1,0,0,0))),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"From", "To"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"ProductFamily", "Date", "ID"}),
#"Expanded Date" = Table.ExpandListColumn(#"Reordered Columns", "Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}})
in
#"Changed Type1"
Really cool and so easy! Thank you very much!