Forum Discussion

DashboardEMECH's avatar
5 years ago
Solved

Adding the data into new row everytime there is an update

I receive a CSV file daily on my email id.  I can perform a powerBI query on the same and arrive at a number.  (For eg:  Sum of a specific column).  I want to have this output store in a different ta...
  • v-yingjl's avatar
    5 years ago

    Hi DashboardEMECH ,

    You can import all your files into a folder, create a table for each day, add custom columns to get the sum value and the created date, for example:

    let
        Source = Folder.Files("C:\Users\xxx\Desktop\files"),
        #"C:\Users\xxx\Desktop\files\_DAY1 xlsx" = Source{[#"Folder Path"="C:\Users\xxx\Desktop\files\",Name="DAY1.xlsx"]}[Content],
        #"Imported Excel" = Excel.Workbook(#"C:\Users\xxx\Desktop\files\_DAY1 xlsx"),
        Table1_Table = #"Imported Excel"{[Item="Table1",Kind="Table"]}[Data],
        #"Added Custom" = Table.AddColumn(Table1_Table, "Date", each Source{[#"Folder Path" = "C:\Users\xxx\Desktop\files\",Name = "DAY1.xlsx"]}[Date created]),
        #"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Date", type datetime}}),
        #"Grouped Rows1" = Table.Group(#"Changed Type", {"Date"}, {{"Sum", each List.Sum([Value]), type nullable number}})
    in
        #"Grouped Rows1"

    intial tableresult table

    Create a blank query to combine these tables:

    Before closing power query, you can disable loading other source tables to improve performance:

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.