Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

'Daily' Deferred Revenue Model

Good Morning all,  I am struggling with this one, I have tried the various 'Deferred Models' Solution to no avail, so I wondered if anyone can try their hand with this one.   I have a Calendar Tabl...
  • serpiva64's avatar
    4 years ago

    Hi,

    i obtained this:

    with these steps:

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU30TcyMDLUMdE3hzAMDQwMdByTSzLLEksy8/N0jEx1DAyUYnWilcxgak1hao2wq40FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type date}, {"Column1.2", type date}, {"Column1.3", Int64.Type}, {"Column1.4", type text}, {"Column1.5", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each ([Column1.2]-[Column1.1])),
    #"Changed Type2" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", Int64.Type}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type2", "Custom.1", each [Column1.5]/[Custom]),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Custom.2", each List.Generate(()=> [Custom],each _> 0, each _ -1)),
    #"Expanded Custom.2" = Table.ExpandListColumn(#"Added Custom2", "Custom.2"),
    #"Changed Type3" = Table.TransformColumnTypes(#"Expanded Custom.2",{{"Custom.2", Int64.Type}, {"Custom.1", type number}}),
    #"Added Custom3" = Table.AddColumn(#"Changed Type3", "Custom.3", each Date.AddDays([Column1.2],-[Custom.2])),
    #"Changed Type4" = Table.TransformColumnTypes(#"Added Custom3",{{"Custom.3", type date}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Changed Type4",{"Custom.3", "Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5", "Custom", "Custom.1", "Custom.2"}),
    #"Removed Columns" = Table.RemoveColumns(#"Reordered Columns",{"Column1.1", "Column1.2", "Column1.5", "Custom", "Custom.2"})
    in
    #"Removed Columns"

     

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !