Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
yashdsin
Frequent Visitor

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?

1 ACCEPTED SOLUTION

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:

006.PNG

You can use the drilldown to gind next hierachy. 

pbix attached: https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdeqcDMD2LNOrKpkoWPmrF...

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

View solution in original post

7 REPLIES 7
yashdsin
Frequent Visitor

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

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

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:

006.PNG

You can use the drilldown to gind next hierachy. 

pbix attached: https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdeqcDMD2LNOrKpkoWPmrF...

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

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

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
v-diye-msft
Community Support
Community 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

 

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.