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! Request now

Reply
Anonymous
Not applicable

RankX with filter and earlier functions but sorte ascending

I´m developing an analysis tht will allow me to identify a production sequency based on times.

I aready have a formula that works, with the correct fields and filters, but when I try to force rank to be sorted ascending the formula lose the filter.

 

Original:

 

RANKX(filter('PRODUCTION ORDERS';'PRODUCTION ORDERS'[Sequence_key]=EARLIER('PRODUCTION ORDERS'[Sequence_key]));'PRODUCTION ORDERS'[Sequence_S1];;)

 

When I force ascending:

RANKX(filter('PRODUCTION ORDERS';'PRODUCTION ORDERS'[Sequence_key]=EARLIER('PRODUCTION ORDERS'[Sequence_key]));'PRODUCTION ORDERS'[Sequence_S1];;1) it lose the ranking tby subcategory sequence_key.

 

Thank you so much,

Cheers,

Fátima

 

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Please check the formula as below. If it doesn't meet your requirement, kindly share your sample data to me.

 

RANKX(CALCULATETABLE('PRODUCTION ORDERS',filter('PRODUCTION ORDERS';'PRODUCTION ORDERS'[Sequence_key]=EARLIER('PRODUCTION ORDERS'[Sequence_key])));'PRODUCTION ORDERS'[Sequence_S1];;1)

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi there,

Thank you very much, but with your formula I lose the filter, so what it does is a kind of overall ranking instead of a ranking by category.

 

As you can see below, teste is the field that I get with your formula, Sequence_S1 is my oriinal formula, so I know for sequence_key 3910L01 I have 36 lines and they are correctly descending sorted, but I need them ascendling sorted.

 

If you see for the next category Sequence_key=4010L1 I have 36 lines... So the subranking by category are working, only the sort is failing.

 

Thank you very much for your support.

Fátima

My data is this:FatimaBIError.JPG

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors