Forum Discussion
Handling week on week change
- 7 years ago
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
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.
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
- v-diye-msft7 years ago
Community Support
Hi yashdsin ,
If my above post helps, could you please consider Accept it as the solution to help the other members find it more quickly. thanks!
Best regards,
Dina Ye