Forum Discussion
Ranking KPI card
- 4 months ago
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)
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:
- Ashish_Mathur4 months ago
Super User
Hi,
Please share the download link of the PBI file with your measures already written and visuals already built. Show the problem there clearly.
- MFelix4 months ago
Super User
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.
- ViralPatel2124 months ago
Resolver I
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.
- MFelix4 months ago
Super User
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.