Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Good day
Why does the following measure returns 1 for all rows? I'm basically trying to rank branches on two measures.
(Make it a data day!)
Solved! Go to Solution.
Hi @Tlotly
Thank you for sharing!
As you describe: the branch code with the highest outstanding principal should be first.
PO_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE(SUM('Sheet1'[Principal Outstanding]), ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,DESC,dense )
new_rank_par_01 =
RANKX(ALL('Sheet1'), [PO_rank] + [PAR_rank] * 1000,,DESC,Dense)
After the code is merged, it is as follows:
Measure new_rank_par_01 =
var PAR_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE([PAR %], ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,ASC,dense )
var PO_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE(SUM('Sheet1'[Principal Outstanding]), ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,DESC,dense )
RETURN RANKX(ALL('Sheet1'), [PO_rank] + [PAR_rank] * 1000,,DESC,Dense)
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Tlotly
I speculate that there could be a filtering issue.
You could simplify the code to make it easier to better check that the results in each section match.
To better help you solve your problem, please provide some dummy data, preferably in tabular form.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I did simplify the code. And I've atatched the sample report on the link below.
So to break the tie, I wanted to use Principal Outstanding i.e. a branch code with the highest principal outstanding should be ranked first.
Thank you in advance.
Hi @Tlotly
Thank you for sharing!
As you describe: the branch code with the highest outstanding principal should be first.
PO_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE(SUM('Sheet1'[Principal Outstanding]), ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,DESC,dense )
new_rank_par_01 =
RANKX(ALL('Sheet1'), [PO_rank] + [PAR_rank] * 1000,,DESC,Dense)
After the code is merged, it is as follows:
Measure new_rank_par_01 =
var PAR_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE([PAR %], ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,ASC,dense )
var PO_rank =
RANKX (
ALLSELECTED (Sheet1[Branch Code] ) ,
CALCULATE(SUM('Sheet1'[Principal Outstanding]), ALLEXCEPT(Sheet1,Sheet1[Branch Code]))
,,DESC,dense )
RETURN RANKX(ALL('Sheet1'), [PO_rank] + [PAR_rank] * 1000,,DESC,Dense)
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-nuoc-msft Thank you very much. It's working perfectly now. I only changed the sorting order in the return measure to ASC since PAR takes precedence. Sorry for not making it clear in my initial response.
Tlotly,
Make it a data day!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
117 | |
75 | |
46 | |
45 | |
32 |
User | Count |
---|---|
172 | |
90 | |
66 | |
46 | |
45 |