Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
How can I create a table (not a visual table) that shows the top two grades per day.
I tried it with functions TOPN and RANK without success.
Thanks
Solved! Go to Solution.
HI @esgaranel,
You can take a look at the following calculate table formula if it suitable for your requirement:
NewTable =
VAR summary =
ADDCOLUMNS (
SUMMARIZE ( Hoja1, [FECHA], [CENTRO], "C_NOTA", COUNT ( Hoja1[NOTA] ) ),
"C_NOTA&RAND", [C_NOTA] + RAND ()
)
RETURN
FILTER (
ADDCOLUMNS (
summary,
"Rank",
RANKX (
FILTER ( summary, [FECHA] = EARLIER ( Hoja1[FECHA] ) ),
[C_NOTA&RAND],
,
DESC,
SKIP
)
),
[Rank] <= 2
)
Notice: my formula will count the 'NOTA' field based on the 'FECHA', 'CENTRO' fields group, I also added RAND function to handle the ranking on these records who has the same 'NOTA' count.
Regards,
Xiaoxin Sheng
Hi @esgaranel,
You can create new calculated table with variable table to summary record and add custom field to get correspond ranking, then filter on the variable table to keep top n rank records based on each group.
If you are confused about coding formula, can you please share some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Ok, we can work with this dataset.
Thanks
HI @esgaranel,
You can take a look at the following calculate table formula if it suitable for your requirement:
NewTable =
VAR summary =
ADDCOLUMNS (
SUMMARIZE ( Hoja1, [FECHA], [CENTRO], "C_NOTA", COUNT ( Hoja1[NOTA] ) ),
"C_NOTA&RAND", [C_NOTA] + RAND ()
)
RETURN
FILTER (
ADDCOLUMNS (
summary,
"Rank",
RANKX (
FILTER ( summary, [FECHA] = EARLIER ( Hoja1[FECHA] ) ),
[C_NOTA&RAND],
,
DESC,
SKIP
)
),
[Rank] <= 2
)
Notice: my formula will count the 'NOTA' field based on the 'FECHA', 'CENTRO' fields group, I also added RAND function to handle the ranking on these records who has the same 'NOTA' count.
Regards,
Xiaoxin Sheng
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
71 | |
56 | |
38 | |
35 |
User | Count |
---|---|
85 | |
66 | |
59 | |
46 | |
45 |