Forum Discussion
Anonymous
6 years agoNot applicable
Users places visited
Hi, I have some data that I want to change. I do not know what to use (Desktop or Query). I need some help for the next: Data: CheckIn User Place 01/01/2020 A MEX 01/01/2020 B ...
- 6 years ago
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"CheckIn", type date}, {"User", type text}, {"Place", type text}}), #"Sorted Rows" = Table.Sort(#"Changed Type",{{"CheckIn", Order.Ascending}}), #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"CheckIn"}), #"Removed Duplicates" = Table.Distinct(#"Removed Columns"), Partition = Table.Group(#"Removed Duplicates", {"User"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}), #"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Place", "Index"}, {"Place", "Index"}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Partition", {{"Index", type text}}, "en-IN"), List.Distinct(Table.TransformColumnTypes(#"Expanded Partition", {{"Index", type text}}, "en-IN")[Index]), "Index", "Place") in #"Pivoted Column"Hope this helps.
- 6 years ago
Hi Anonymous ,
In the appendix you will find the solution with a CSV source.
mwegener
Most Valuable Professional
6 years agoHi Anonymous
take a look at the attached PBIX file.
Here you can find some information about the most important steps.
https://www.excelguru.ca/blog/2018/06/27/number-rows-by-group-using-power-query/