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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Count Top 1 Rank per day

Hey guys,

I'm trying to get a column that shows the number of days that specific team has ranked 1st

 

I have a ranking measure based on a score measure that looks like this:

JasonCou_0-1707411605186.png

The data has a colum for the Team Name, the points and the date which is filtered using an date slicer.

I'm trying to get a rank for each date within the slicer and count how many times each team has ranked 1st place in each date.

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@Anonymous 

 

this is the sample data i have used: 

Daniel29195_0-1707423763205.png

 

result : 

Daniel29195_1-1707423782760.png

 

power bi result : 

Daniel29195_3-1707423845040.png

 

 

 

 

measure : 

rank measure = 

rnk = 
RANKX(
    ALLSELECTED(tbl_rank[Team]),
    [total points],
    ,DESC
)

 

 

 

nb of days measure

nb of days n1 = 

var ds = 
ADDCOLUMNS(
    CALCULATETABLE(
    SUMMARIZE(
        tbl_rank,
        tbl_rank[date],
        tbl_rank[Team]
    ),
    ALLSELECTED(tbl_rank[Team])
    ),
    "@r" , [rnk]
)


var s = 
GROUPBY(
    ds,
    [@r],
    tbl_rank[Team],
    "c", COUNTX(CURRENTGROUP() , 1 )
)

return 

SUMX(
    
    FILTER(
        s,
        tbl_rank[Team] in VALUES(tbl_rank[Team]) && [@r] = 1 
    ),
        [c])


 

 

 

hope this works for you .

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

It worked wonderfully, thank you very much. 
I'm having a little trouble understanding how did you archive it! How does the meassure work? (logic wise)

Daniel29195
Super User
Super User

@Anonymous 

 

this is the sample data i have used: 

Daniel29195_0-1707423763205.png

 

result : 

Daniel29195_1-1707423782760.png

 

power bi result : 

Daniel29195_3-1707423845040.png

 

 

 

 

measure : 

rank measure = 

rnk = 
RANKX(
    ALLSELECTED(tbl_rank[Team]),
    [total points],
    ,DESC
)

 

 

 

nb of days measure

nb of days n1 = 

var ds = 
ADDCOLUMNS(
    CALCULATETABLE(
    SUMMARIZE(
        tbl_rank,
        tbl_rank[date],
        tbl_rank[Team]
    ),
    ALLSELECTED(tbl_rank[Team])
    ),
    "@r" , [rnk]
)


var s = 
GROUPBY(
    ds,
    [@r],
    tbl_rank[Team],
    "c", COUNTX(CURRENTGROUP() , 1 )
)

return 

SUMX(
    
    FILTER(
        s,
        tbl_rank[Team] in VALUES(tbl_rank[Team]) && [@r] = 1 
    ),
        [c])


 

 

 

hope this works for you .

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.