Forum Discussion
Anonymous
5 years agoNot applicable
Filter out top 3 rows based on same timestamp
Hello, Im new to power bi, and would be very grateful if someone could help me out. I have table with 3 columns timestamp, procedure, average_cpu. Everytime when data gets generated its ...
- 5 years ago
Do a Group By on the timestamp column with a new column that keeps all rows for each separate time stamp.
This will generate a step with code that looks like this:
= Table.Group(#"Changed Type", {"timestamp"}, {{"Top3", each _, type table}})We want to modify this slightly using Table.MaxN:
= Table.Group(#"Changed Type", {"timestamp"}, {{"Top3", each Table.MaxN(_, "avergae_cpu", 3), type table}})All that's left is to expand the new Top3 table column by clicking the expand button in the top right corner and pick which columns you want.
Fowmy
Super User
5 years agoAnonymous
Create a new table with the following code:
FILTER(
ADDCOLUMNS (
Table1,
"Top3",
TABLE1[avergae, cpu]
IN SELECTCOLUMNS (
TOPN (
3,
ALLEXCEPT ( Table1, table1[timestamp] ),
CALCULATE ( MAX ( table1[avergae, cpu] ) )
),
Table1[avergae, cpu]
)
),
[Top3] = TRUE ()
)