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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
ViralPatel212
Resolver I
Resolver I

Ranking KPI card

I have a page with differnent slicers. in the example the table has been sliced with period = q3, Dealer = 107 and Participant = Client 2. the Ranking on the table works perfectly as its ranks Client 2 within group A for Dealer 107 as 2. However i need to show that 2 in a KPI card. Tried to use that measure in a KPI but it returns as 1 always.

this is the dealer Rank (in group) measure: 

Dealer Rank (in Group) =
RANK(DENSE, ALLSELECTED('Dealer Ranking'[Participant]), ORDERBY([Commission 1], DESC, [Participant]))

ViralPatel212_0-1778152521195.png

thanks

viral

1 ACCEPTED SOLUTION
ViralPatel212
Resolver I
Resolver I

HI everyone

 

Thanks for the suggestion!

 

i was able to figure it out with this dax: 

 

Dealer Ranking KPI = 
 
VAR _group = MAX('Dealer Ranking'[Participant Group])
VAR _dealer = MAX('Dealer Ranking'[Dealer])
VAR _participant = SELECTEDVALUE('Dealer Ranking'[Participant])
VAR _currentComm = 
    CALCULATE(
        SUM('Dealer Ranking'[Commission LC - Everyone]),
        'Dealer Ranking'[Participant] = _participant
    )
VAR _participants = 
    CALCULATETABLE(
        VALUES('Dealer Ranking'[Participant]),
        REMOVEFILTERS('Dealer Ranking'[Participant]),
        KEEPFILTERS('Dealer Ranking'[Participant Group] = _group),
        'Dealer Ranking'[Dealer] = _dealer
    )
VAR _withComm = 
    ADDCOLUMNS(
        _participants,
        "Comm", CALCULATE(SUM('Dealer Ranking'[Commission LC - Everyone]))
    )
RETURN
RANKX(_withComm, [Comm], _currentComm, 0)

View solution in original post

17 REPLIES 17
ViralPatel212
Resolver I
Resolver I

HI everyone

 

Thanks for the suggestion!

 

i was able to figure it out with this dax: 

 

Dealer Ranking KPI = 
 
VAR _group = MAX('Dealer Ranking'[Participant Group])
VAR _dealer = MAX('Dealer Ranking'[Dealer])
VAR _participant = SELECTEDVALUE('Dealer Ranking'[Participant])
VAR _currentComm = 
    CALCULATE(
        SUM('Dealer Ranking'[Commission LC - Everyone]),
        'Dealer Ranking'[Participant] = _participant
    )
VAR _participants = 
    CALCULATETABLE(
        VALUES('Dealer Ranking'[Participant]),
        REMOVEFILTERS('Dealer Ranking'[Participant]),
        KEEPFILTERS('Dealer Ranking'[Participant Group] = _group),
        'Dealer Ranking'[Dealer] = _dealer
    )
VAR _withComm = 
    ADDCOLUMNS(
        _participants,
        "Comm", CALCULATE(SUM('Dealer Ranking'[Commission LC - Everyone]))
    )
RETURN
RANKX(_withComm, [Comm], _currentComm, 0)
v-veshwara-msft
Community Support
Community Support

Hi @ViralPatel212 ,


Thanks for reaching out to Microsoft Fabric Community.

Just checking in to see if your query is resolved and if any responses were helpful.
Otherwise, feel free to reach out for further assistance.

Also to assist better, could you share sample data or sample .pbix file without any sensitive information. You can upload your files to any cloud storage like OneDrive or GoogleDrive and paste the link here with appropriate permissions.

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Thank you.

cengizhanarslan
Super User
Super User

It would be easier if you have shared an example dataset but without that I gues it has to be something like this:

Dealer Rank (Card) =
VAR _SelectedParticipant =
    SELECTEDVALUE ( 'Dealer Ranking'[Participant] )
VAR _SelectedGroup =
    SELECTEDVALUE ( 'Dealer Ranking'[Participant Group] )
VAR _RankTable =
    ADDCOLUMNS (
        CALCULATETABLE (
            VALUES ( 'Dealer Ranking'[Participant] ),
            ALLSELECTED ( 'Dealer Ranking'[Participant] ),
            'Dealer Ranking'[Participant Group] = _SelectedGroup
        ),
        "@Comm", CALCULATE ( [Commission 1] )
    )
RETURN
    COUNTROWS (
        FILTER (
            _RankTable,
            [@Comm] > CALCULATE ( [Commission 1] )
        )
    ) + 1
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
ViralPatel212
Resolver I
Resolver I

I have a page with differnent slicers. in the example the table has been sliced with period = q3, Dealer = 107 and Participant = Client 2. the Ranking on the table works perfectly as its ranks Client 2 within group A for Dealer 107 as 2. However i need to show that 2 in a KPI card. Tried to use that measure in a KPI but it returns as 1 always.

this is the dealer Rank (in group) measure: 

Dealer Rank (in Group) =
RANK(DENSEALLSELECTED('Dealer Ranking'[Participant]), ORDERBY([Commission 1]DESC[Participant]))
ViralPatel212_0-1778153063772.png

 

Hi,

Please share the download link of the PBI file with your measures already written and visuals already built.  Show the problem there clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @ViralPatel212 ,

 

That specific card you are refering has a filter on the specific customer?

Since you are using the ALLSELECTED it will only have impact on the participants on the query in this matrix you have Client 1 and Client 2 giving you the number 2, being on a card visual the allselected will have the number 1 since the context is different and you only get a single result.

 

Can you explain what is the intended purpose and how the card is setup in values and filters.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Hello @MFelix  

 

The KPI card shows the rank of the currently selected participant's dealer against all other participants in the same Participant Group. It answers: "How well does my dealer rank within my group?"

Card Setup:

Filters on the card:

  • Participant Group = [From page slicer]
  • Dealer = [From page slicer]
  • NOTE: NO filter on Participant by default there page will be filtered to client 2

Values:

  • The ranking measure that compares the current participant's commission against all others in the group

How it should work: When a user (Client 2) views the report:

  • Page filter shows: Participant Group = "Group A", Dealer = "Dealer 107"
  • The slicer shows they are viewing as "Client 2"
  • The KPI should rank Client 2's commission against Client 1's commission within Group A
  • Result: Rank 2 of 2

The issue is that the measure needs to evaluate "Client 2's commission vs all participants in Group A" without the Participant slicer restricting what participants are visible to the calculation.

Hi @ViralPatel212 ,

 

Now I understand the concept that you are trying to give so in this case I believe that what you need is to recalculate the measure in order to get the correct context for that specific user inside the page filter so in this case remove the filter context of the Client that is currently seeing the report based on it's selection.

 

Not sure if the Group is coming from the same table has the participant but if it's from a different table just change your calculation for the card:

 

Dealer Rank (in Group) CARD VISUAL =
RANK(DENSE, ALL('Dealer Ranking'[Participant]), ORDERBY([Commission 1], DESC, [Participant]))

 

This should return the correct number for that specific calculation.

 

If this does not work can you please let me know what is the relation between the  Dealer and the Participation group are they part of the same table, are they in the dimension table or the fact table how is that calculating for the rank.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





hello @MFelix 

 

Afraid that did not work, just returned the number 3 where it should be 2 both dealer and participants are in the same table For example Group A has got Partipant 1,2 and Group B has got Participant 3 

 

 

 

In terms of model how is the Group related wirth the participant?
Are they part of the same table?

What does your model look like, is it possible to send a sample file of your report.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





lbendlin
Super User
Super User

is the KPI card impacted by an independent slicers?  You will need to strategically place a REMOVEFILTERS in your measure for the RANK to have an actual table to work with.

 

lbendlin_0-1778158573960.png

 

 

hi @lbendlin 

Where would i place it? 

this is what my goal is: 

The KPI card shows the rank of the currently selected participant's dealer against all other participants in the same Participant Group. It answers: "How well does my dealer rank within my group?"

Card Setup:

Filters on the card:

  • Participant Group = [From page slicer]
  • Dealer = [From page slicer]
  • NOTE: NO filter on Participant by default there page will be filtered to client 2

Values:

  • The ranking measure that compares the current participant's commission against all others in the group

How it should work: When a user (Client 2) views the report:

  • Page filter shows: Participant Group = "Group A", Dealer = "Dealer 107"
  • The slicer shows they are viewing as "Client 2"
  • The KPI should rank Client 2's commission against Client 1's commission within Group A
  • Result: Rank 2 of 2

The issue is that the measure needs to evaluate "Client 2's commission vs all participants in Group A" without the Participant slicer restricting what participants are visible to the calculation.

the currently selected participant

see my edited reply.  You will need to explain how you do that in the UI.

hello @lbendlin  these are the slicers that i used: 

i tried the dax but my card show (Blank) 

Dealer Ranking KPI =


VAR _group = SELECTEDVALUE('Dealer Ranking'[Participant Group])
var a =
CALCULATETABLE(
    'Dealer Ranking', 'Dealer Ranking'[Participant Group] = _group,
    REMOVEFILTERS('Dealer Ranking'[Participant]))
RETURN
RANK(DENSE, a,ORDERBY([Commission 1],DESC,[Participant]))

ViralPatel212_0-1778159202525.png

 

The Participant slicer needs to be fed from a disconnected table.

could you share the file where you created it? as its not working for me?

 

thanks

 

see attached

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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