Forum Discussion

mmunozjr5's avatar
mmunozjr5
Frequent Visitor
2 years ago
Solved

Show Highest Value Per Two Variables (Category) and (Hour)

Hello, I would like to create a table or graph that would only show the Hour and Total Count for that hour but for only the highest value for each category. For example, for this scenario, it woul...
  • ryan_mayu's avatar
    2 years ago

     

    mmunozjr5 

    you can do this in pq

    let
    Source = Table,
    #"Grouped Rows" = Table.Group(Source, {"Category", "Hour"}, {{"value", each List.Sum([Count]), type nullable number}}),
    Custom1 = Table.AddColumn(#"Grouped Rows","Rank",each Table.RowCount(Table.SelectRows(#"Grouped Rows",(x)=>x[value]>[value] and x[Category]=[Category]))+1),
    #"Filtered Rows" = Table.SelectRows(Custom1, each ([Rank] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Rank"})
    in
    #"Removed Columns"

     

     

    pls see the attachment below