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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kompalli
Helper I
Helper I

Rank in a card

Hi
Need Help
I was trying to display rank in a card. Below are the details of I am trying to do.

  • Below is the Table I have Company names and sales. One company has different names so I ranked first based on all companies and then tried to filter Nike rankings to get the top rank among the Nike company. 

1.png

 5.png

Below are the measures which I used.

NIKE Sales Ranking =
VAR A =  RANKX(
        ALL(Company[Company]),
        [Total sales])
VAR _Rank = IF(MAX(Company[Market/Nike]) = "NIKE",A)
RETURN
_Rank
 
 
 By using below formula I was able to get the top company name based on ranking among Nike Company as shown in the above screenshot. But I want to display the Rank of the top company in the card. Is there any work around where I can display Rank value on the card.
 
Top Nike Sales =
FIRSTNONBLANK (
    TOPN (
        1,
        VALUES ( Company[Company]),
        CALCULATE ([NIKE Sales Ranking]),ASC
    ),
    1
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kompalli ,

I updated my sample pbix file(see the attachment), please check if that is what you want. It return 3 not 4, I'm not sure if it is correct or not...

NIKE Sales Ranking = RANKX ( ALL ( Company ), [Total sales] )
Measure = 
VAR _tab =
    SUMMARIZE (
        'Company',
        'Company'[Market/Nike],
        'Company'[Company],
        "@totalsales", [Total sales],
        "@rank", [NIKE Sales Ranking]
    )
RETURN
    MINX ( FILTER ( _tab, Company[Market/Nike] = "NIKE" ), [@rank] )

yingyinr_0-1675994338458.png

Best Regards

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @kompalli ,

What's your expected result? Do you want to get the rank value or the sales which the rank is 1? Since you only need to get the top 1 customer, then the rank value should be 1. If you want to get the sales which the rank is 1, you can create a measure as below to get it:

Measure = 
VAR _tab =
    SUMMARIZE (
        'Company',
        'Company'[Market/Nike],
        'Company'[Company],
        "@totalsales", [Total sales],
        "@rank", [NIKE Sales Ranking]
    )
RETURN
    MAXX ( FILTER (_tab, [@rank] = 1 ), [@totalsales] )

yingyinr_0-1675929460009.png

If the above one can't help you get the expected result, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Hi @Anonymous 

 

Thanks for you quick response, The method you followed is exactly what I need but I want to show top Rank of Nike in the card and not the sales value or company name. Can that be done.

 

Thanks in advance

Anonymous
Not applicable

Hi @kompalli ,

I'm not clear about your requirement, could you please provide the exact value which you want to display in the card visual finally base on the below table data?

yingyinr_1-1675934066397.png

yingyinr_4-1675934300114.png

Best Regards

Hi @Anonymous 

 

Please find the below image to get details of the requirement.

 

1.png

Anonymous
Not applicable

Hi @kompalli ,

I updated my sample pbix file(see the attachment), please check if that is what you want. It return 3 not 4, I'm not sure if it is correct or not...

NIKE Sales Ranking = RANKX ( ALL ( Company ), [Total sales] )
Measure = 
VAR _tab =
    SUMMARIZE (
        'Company',
        'Company'[Market/Nike],
        'Company'[Company],
        "@totalsales", [Total sales],
        "@rank", [NIKE Sales Ranking]
    )
RETURN
    MINX ( FILTER ( _tab, Company[Market/Nike] = "NIKE" ), [@rank] )

yingyinr_0-1675994338458.png

Best Regards

Hi @Anonymous 

Thankyou for the quick response. I am sorry actually it was 3 by mistake I mentioned it 4. This was really very helpful🙂.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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