Forum Discussion

yashdsin's avatar
yashdsin
Frequent Visitor
7 years ago
Solved

Handling week on week change

Sample data file

Hi,

I have a sample data(attached) and i want to show the visualization for this data in Power Bi which has a new data added every week. Is there and solution to this?

  • Hi yashdsin ,

     

    Please connect the sample worksheet, and then use the below Mcode in query editor:

    let
        Source = Excel.Workbook(File.Contents("C:\Users\dinaye\Desktop\Sample (1).xlsx"), null, true),
        Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
        #"Changed Type" = Table.TransformColumnTypes(Sheet1_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type any}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}, {"Column8", type any}, {"Column9", type any}, {"Column10", type any}, {"Column11", type any}, {"Column12", type any}}),
        #"Filled Down" = Table.FillDown(#"Changed Type",{"Column1", "Column2"}),
        #"Transposed Table" = Table.Transpose(#"Filled Down"),
        #"Replaced Value" = Table.ReplaceValue(#"Transposed Table",null,0,Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12"}),
        #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","Same",null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12"}),
        #"Filled Down1" = Table.FillDown(#"Replaced Value1",{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12"}),
        #"Replaced Value2" = Table.ReplaceValue(#"Filled Down1",0,null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12"}),
        #"Transposed Table1" = Table.Transpose(#"Replaced Value2"),
        #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true]),
        #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Months", type text}, {"Commodity", type text}, {"Specification", type text}, {"6/10/2019", Int64.Type}, {"6/17/2019", Int64.Type}, {"6/24/2019", Int64.Type}, {"7/2/2019", Int64.Type}, {"7/8/2019", Int64.Type}, {"7/15/2019", Int64.Type}, {"7/22/2019", Int64.Type}, {"7/29/2019", Int64.Type}, {"7/29/2019_1", type any}})
    in
        #"Changed Type1"

    Then apply the change, and build the visual:

    You can use the drilldown to gind next hierachy. 

    pbix attached: https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdeqcDMD2LNOrKpkoWPmrFkBED3D0G31L2rlschfnacP5g?e=jBgzhN

7 Replies

  • v-diye-msft's avatar
    v-diye-msft
    Icon for Community Support rankCommunity Support

    Hi yashdsin ,

     

    I can't access your data with your link, it seems the accessbility is limited. would you mind sharing on Onedrive using "Anyone with the link can edit"? or using dropbox? Make sure the confidential info has been removed before.

     

    Best regards,

    Dina Ye

     

    • v-diye-msft's avatar
      v-diye-msft
      Icon for Community Support rankCommunity Support

      Hi yashdsin ,

       

      Successfully got your data, thanks!  how do you want to show the visual? 

      And am coufused about what does the "same" represent? same as the left one? Or the down-next one?

       

      Best regards,

      Dina Ye

      • yashdsin's avatar
        yashdsin
        Frequent Visitor

        I update this table every week and i am trying to get a meaniningfull visualization for this so that whenever i update a new column with a new date it reflects in visualization rather then sending this data table. Your inputs will be great. Data will go down next one for the upcoming month of Aug.