Forum Discussion

starmoonknight's avatar
9 years ago
Solved

How to add rows to a date table in Query Editor

Hi all,   I'm a PBI user, and have been playing around for a while, but still not very familiar with "M" (sick of all the different languages I have to learn, MDX, M, DAX ...).   I'd just go stra...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi starmoonknight,

    Firstly, you can define only one of the date and add a specific number of intervals as follows.

    List.Dates( #date(2016,9,1), 30, #duration(1,0,0,0))


    Secondly, you can open advanced editor and directly modify the source codes of your date table to add rows for it. Below is an example for your reference.

    let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwNNM3sNA3slSK1UFwjQ1QuYZKsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), Source1 = Table.FromList(List.Dates( #date(2016,9,1), 30, #duration(1,0,0,0)), Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Changed Type1" = Table.TransformColumnTypes(Source,{{"Column1", type date}}), #"Changed Type" = Table.TransformColumnTypes(#"Changed Type1",{{"Column1", type date}}), #"Appended Query" = Table.Combine({#"Changed Type", Source1}), #"Changed Type2" = Table.TransformColumnTypes(#"Appended Query",{{"Column1", type date}})in #"Changed Type2"



    Thanks,
    Lydia Zhang