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

Help please - Ranking distinct count of mobile numbers per plan

Hi,

 

I need to place a rank based on the distinct number of mobile numbers. It is not working based on the formula below:

 

Formula used: 

Services Count Rank = RANKX(ALL('Main Table'[FLEXIPLAN_NAME]), DISTINCTCOUNT('Main Table'[MOBILE_NUMBER]))
 

jdalfonso_1-1621764807321.png

 

The ranks are all 1s. 

 

My goal is to be able to show the rank per plan name based on the selected plan name on the left. 

2 ACCEPTED SOLUTIONS
CNENFRNL
Community Champion
Community Champion

highly likely,

Services Count Rank =
RANKX (
    ALLSELECTED ( 'Main Table'[FLEXIPLAN_NAME] ),
    CALCULATE ( DISTINCTCOUNT ( 'Main Table'[MOBILE_NUMBER] ) )
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Since you cant share sample file, so I create a sample based on your sample data, lets discuss the problem on this file.

-

Create the measures:

 

Count of Mobile = DISTINCTCOUNT('Table'[Mobile Number])
Rank = RANKX(ALL('Table'[Plan Name]), [Count of Mobile])

 

Result:

v-xiaotang_0-1621907225173.png

 

v-xiaotang_1-1621907225177.png

See sample file attached bellow.

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Since you cant share sample file, so I create a sample based on your sample data, lets discuss the problem on this file.

-

Create the measures:

 

Count of Mobile = DISTINCTCOUNT('Table'[Mobile Number])
Rank = RANKX(ALL('Table'[Plan Name]), [Count of Mobile])

 

Result:

v-xiaotang_0-1621907225173.png

 

v-xiaotang_1-1621907225177.png

See sample file attached bellow.

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

highly likely,

Services Count Rank =
RANKX (
    ALLSELECTED ( 'Main Table'[FLEXIPLAN_NAME] ),
    CALCULATE ( DISTINCTCOUNT ( 'Main Table'[MOBILE_NUMBER] ) )
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Hi @CNENFRNL When I click on a particular plan name, the result of this foruma in the table become 1. It is accurate when I dont select any of the plan names.

 

When I select plan names:

all values are 1.

 

When I dont select plan names:

jdalfonso_1-1621770407613.png

 

I need to show the rank in a card visual according to the rank of plan name by mobile number. But when I select a plan from the slicers, all of them becomes 1. 

 

Anonymous
Not applicable

What if I want to introduce another variable in case there are ties? 

Fowmy
Super User
Super User

@Anonymous 

Can you share your sample data in text format? you can paste it in your reply here.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi @Fowmy 

 

I cannot post sample data since this is confidential. But the structure is:

 

jdalfonso_0-1621769099840.png

I would also need to break ties in case there are ties. I want to introduce a third variable.

 

Thanks

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.

Top Solution Authors