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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to count drop in trip

Could anyone help recommend formula please. For example, I would like to count distinct Store name by trip and also provide ranking as in count drop column. Thank you.

Trip no.Store nameCount drop
Trip1A1
Trip1B2
Trip2A1
Trip2B2
Trip2C3
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Incase you want a Calculated Column

 

count1 drop = 
RANKX (
    FILTER (
        RankDrop,
        'RankDrop'[Trip no.]
            = EARLIER ( 'RankDrop'[Trip no.] )
    ),
    'RankDrop'[Store name] ,,ASC
)

 

1.jpg
 
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

6 REPLIES 6
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Incase you want a Calculated Column

 

count1 drop = 
RANKX (
    FILTER (
        RankDrop,
        'RankDrop'[Trip no.]
            = EARLIER ( 'RankDrop'[Trip no.] )
    ),
    'RankDrop'[Store name] ,,ASC
)

 

1.jpg
 
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Anonymous
Not applicable

Hi @Anonymous ,

For my test , maybe you used the formula for "New Column" . It is used for "New measure".

8.14回8.13.PNG

Best regards,

Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

According to my understanding, you want to rank based on two columns , right?

You could use the following formula:

count drop =
RANKX (
    FILTER ( ALL ( RankDrop ), 'RankDrop'[Trip no.] = MAX ( 'RankDrop'[Trip no.] ) ),
    CALCULATE ( MAX ( ( 'RankDrop'[Store name] ) ) ),
    ,
    ASC
)

My visualization looks like this:

8.13.3.PNG

Is the result what you want? If not, please upload some detailed data samples and expected output.

Please do mask sensitive data before uploading.

 

Best Regards,

Eyelyn Qin

Anonymous
Not applicable

I have try on your formula but there is alert shown "A circular dependency was detect"

amitchandak
Super User
Super User

@Anonymous ,For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

 

You can try like this too

Count Drop = countx(filter(Table,[Trip no]=[Trip no] && [Store name]<=[Store name]),[Store name])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @Anonymous 

 

Calculate(DISTINCTCOUNT(table[store_name]), allexcept(table, table[trip_id))

For rank you can refer to the video 

https://www.youtube.com/watch?v=3u0WJFKxGJk

 

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

Regards,
Pranit

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.