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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mmunozjr5
New Member

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 would show 4 bars or rows in a table as follows: (Dataset enclosed) Thank you!

 

 

Call    |  2:00 PM | Total = 2

Email |  1:00 PM | Total = 3

Page  | 9:00 AM | Total = 2

Text   | 8:00 AM |  Total  = 5

 

mmunozjr5_0-1715127824969.png

 

CategoryHourCount
Text1:00 PM1
Email9:00 AM1
Email10:00 AM1
Call11:00 PM1
Page9:00 AM1
Text8:00 AM1
Email10:00 PM1
Email4:00 PM1
Call2:00 PM1
Page3:00 PM1
Text8:00 AM1
Email2:00 PM1
Email1:00 PM1
Call10:00 PM1
Email8:00 AM1
Call2:00 PM1
Email1:00 PM1
Text10:00 PM1
Text8:00 AM1
Text2:00 PM1
Text1:00 PM1
Text10:00 PM1
Text8:00 AM1
Text2:00 PM1
Call1:00 PM1
Call4:00 PM1
Email2:00 PM1
Email11:00 AM1
Page8:00 AM1
Email4:00 PM1
Page9:00 PM1
Email10:00 PM1
Call9:00 AM1
Email1:00 PM1
Text10:00 AM1
Text9:00 AM1
Page10:00 AM1
Page11:00 PM1
Page9:00 AM1
Text8:00 AM1



1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

 

@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

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

 

@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

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thank you so much for your time and effort in providing me with this solution. Perfect! Thanks!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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