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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Excel IF RANK Formula in DAX

Hi, 

 

I am struggling to acheive a ranking in PBI. In Excel the formula is:

 

=IF(A45="","",IF(A45<>"",RANK(D45,$D$45:$D$9999),""))

 

Column A = Customer Name

Column D = Margain figures

 

Is there a DAX version of this at all please?

 

Thanks in advance

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Do you want to use DAX to calculate the ranking of the corresponding margin among all customers' margins when the customer name is not empty? If I understand correctly, you can try the following formula.

 

Create a calculated column.

rank = IF('Table'[Customer Name]="",BLANK(),RANKX(FILTER(ALL('Table'),'Table'[Customer Name]<>""),'Table'[Margain figures]))

The output of my test.

vmengmlimsft_1-1738566438119.png

 

 

 

———————————————————————————————————————————————————

If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

 

Best regards,

Mengmeng Li

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Do you want to use DAX to calculate the ranking of the corresponding margin among all customers' margins when the customer name is not empty? If I understand correctly, you can try the following formula.

 

Create a calculated column.

rank = IF('Table'[Customer Name]="",BLANK(),RANKX(FILTER(ALL('Table'),'Table'[Customer Name]<>""),'Table'[Margain figures]))

The output of my test.

vmengmlimsft_1-1738566438119.png

 

 

 

———————————————————————————————————————————————————

If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

 

Best regards,

Mengmeng Li

audreygerred
Super User
Super User

Hi! Here is the RANKX DAX informations: RANKX function (DAX) - DAX | Microsoft Learn

 





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

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 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.