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

Join 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.

Reply
esgaranel
Frequent Visitor

esgaranel

How can I create a table (not a visual table) that shows the top two grades per day.

 

noTable.png

topN.png

I tried it with functions TOPN and RANK without success.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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
    )

 

1.PNG

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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

Anonymous
Not applicable

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
    )

 

1.PNG

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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