Forum Discussion
Uzi2019
3 years agoCommunity Champion
Split data month wise
Hi Experts, I have 3 columns Date( Continuous Date), Campaign Start Date, Campaign End date. I want month wise split as I mentioned in screenshot. Please help me to get this done. T...
- 3 years ago
Uzi2019 , You can do that power query, expand the same table
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTLXNzTRNzIwMgKyLfWNIcxYnWglkICZvpEFTBLItoTKxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"S N" = _t, #"Start Date" = _t, #"End Date" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Date", type date}, {"End Date", type date}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "New Start Date", each let _s =[Start Date], _q= List.Select( List.Dates([Start Date], Duration.Days([End Date]-[Start Date])+1,#duration(1,0,0,0)), each _ = List.Max({_s,Date.StartOfMonth(_)})) in _q), #"Expanded New Start Date" = Table.ExpandListColumn(#"Added Custom", "New Start Date"), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded New Start Date",{{"New Start Date", type date}}), #"Added Custom1" = Table.AddColumn(#"Changed Type1", "New End Date", each List.Min({[End Date], Date.EndOfMonth([New Start Date])})) in #"Added Custom1"
Uzi2019
3 years agoCommunity Champion
Hi amitchandak
Thank you for your response.
But I want the result in measure or column. Need to show againts various different measures and metrics.
So cant create seperte table fo this.
amitchandak
3 years agoSuper User
Uzi2019 , You can do that power query, expand the same table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTLXNzTRNzIwMgKyLfWNIcxYnWglkICZvpEFTBLItoTKxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"S N" = _t, #"Start Date" = _t, #"End Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Date", type date}, {"End Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "New Start Date", each let
_s =[Start Date],
_q= List.Select( List.Dates([Start Date], Duration.Days([End Date]-[Start Date])+1,#duration(1,0,0,0)), each _ = List.Max({_s,Date.StartOfMonth(_)}))
in
_q),
#"Expanded New Start Date" = Table.ExpandListColumn(#"Added Custom", "New Start Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded New Start Date",{{"New Start Date", type date}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "New End Date", each List.Min({[End Date], Date.EndOfMonth([New Start Date])}))
in
#"Added Custom1"