I have a rather vexing situation in PowerBI. I developed a rank for my company's employees based on minimal time it takes them to do something. It's a ranking based on three separate factors; to do this, 'rank' had to be a measure.
So, I have a measure 'rank' which works as I intend it to:
Rank = IF ( HASONEVALUE( Query1[Employee Name] ), RANKX( ALLSELECTED ( Query1[Employee Name] ), [Rank_Total],, TRUE) )
where [Rank_Total]
is the measure that creates a raw score of the three separate factors I mentioned earlier. So, [Rank_Total]
creates a raw score, and [Rank]
orders the raw values in [Rank_Total]
.
Here's where things get weird: if I want to simply choose the top 5 entries based on [Rank]
, I get nothing.
Here's what I mean: I created a measure called Test Measure
, and I set it to:
Test Measure = IF( [Rank] < 6, 1, 0 )
This updated the matrix appropriately:
However, when I filter "Test Measure" to only include the "1's," this happens:
Does anyone have a suggestion as to why this is happening, and what an appropriate workaround is?
EDITED TO ADD: Here is a link to a Google public sheet for example data. The parameters I have are as follows:
Loan Count = COUNT(Query1[Loan Number])
Loan Count by Employee = Loan Count by Employee = CALCULATE([Loan Count], GROUPBY(Query1, Query1[Employee Name]))
Volume = Sum(Query1[Loan Amount])
Avg CTC Time = AVERAGE(Query1[CTC Time])
Avg CTC Time by Employee = CALCULATE([Avg CTC Time], GROUPBY(Query1, Query1[Employee Name]))
Now, for the Ranks. The Rank I have to based on three separate factors, in the following order:
- Lowest CTC Time
- Highest Loan Count
- Highest Volume
Here are the measures:
Rank_CTCLength = IF ( HASONEVALUE( Query1[Employee Name] ), RANKX( ALLSELECTED ( Query1[Employee Name] ), [Avg CTC Time by Employee],, TRUE) )
Rank_LoanCount = IF ( HASONEVALUE( Query1[Employee Name] ), RANKX( ALLSELECTED ( Query1[Employee Name] ), [Loan Count] ,, False) )
Rank_LoanVolume = IF ( HASONEVALUE( Query1[Employee Name] ), RANKX( ALLSELECTED ( Query1[Employee Name] ), [Volume],, False) )
I factored all three of them to make a "raw score" titled "Rank_Total":
Rank_Total = FORMAT([Rank_CTCLength]+[Rank_LoanCount]*POWER(10,-4)+[Rank_LoanVolume]*POWER(10,-8),"00000.00000000%")
From there, I created the final rank parameter titled Rank
:
Rank = IF ( HASONEVALUE( Query1[Employee Name] ), RANKX( ALLSELECTED ( Query1[Employee Name] ), [Rank_Total],, TRUE) )