Forum Discussion

ahmed_hm's avatar
ahmed_hm
Regular Visitor
4 years ago
Solved

Repeat the same value for whole month

Hi there,    I have a table containing the first date of each month and the budget for that day, this VALUE will be fixed daily, now I need to create a new table in Power BI to repeat this value fo...
  • Vijay_A_Verma's avatar
    4 years ago

    See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJS0lGyMLNQitWJVjJCCBkaGYOFjBFClhBFJsiKTMBCpgghE1MzpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Budget = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Budget", Int64.Type}}),
        #"Added Custom" = Table.ReplaceValue(#"Changed Type",each [Date], each List.Dates([Date],Date.DaysInMonth([Date]),#duration(1,0,0,0)),Replacer.ReplaceValue,{"Date"}),
        #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date")
    in
        #"Expanded Date"