Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Dear PBI enthusiasts!
I have a requirement where I need to show the Top N of a column '%Profit' and if there is a tie then I need to use the column 'Total Sales'. I am using RankX for my first column but not getting the second column to be used when there is a tie.
Any help would be greatly appreciated and thank you in advance!
Solved! Go to Solution.
Hi @DivyaReddy ,
try this measure
Rank =
VAR Rank1 =
RANKX(ALL(Facts),
[% Profit]
)
VAR Rank2 =
VAR CurrentProfit = [% Profit]
RETURN
RANKX(
CALCULATETABLE(
FILTER(
ADDCOLUMNS(
Facts,
"@Total Sales",[Total Sales],
"@%Profit",[% Profit]
),
[% Profit] = CurrentProfit
),
ALL('Facts')),
[Total Sales]
)
RETURN
Rank1*Rank2
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DivyaReddy ,
try this calculated column:
This seems to have worked in theory but not sure why I get "Parameter not correct type" for "EARLIER('Facts14'[%Profit])" and EARLIER('Facts14'[Total Sales]) when I substituted my actual column and table names They They are measures (not columns) in my actual data not sure if that matters?
Hi @DivyaReddy ,
try this measure
Rank =
VAR Rank1 =
RANKX(ALL(Facts),
[% Profit]
)
VAR Rank2 =
VAR CurrentProfit = [% Profit]
RETURN
RANKX(
CALCULATETABLE(
FILTER(
ADDCOLUMNS(
Facts,
"@Total Sales",[Total Sales],
"@%Profit",[% Profit]
),
[% Profit] = CurrentProfit
),
ALL('Facts')),
[Total Sales]
)
RETURN
Rank1*Rank2
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Looking into it - thank u so much!
HI @DivyaReddy ,
Did I answer your question? Mark this post as a solution if I did!
not very clear for me
Sorry abt that - updated the description and hopefully it is better now.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
79 | |
59 | |
36 | |
33 |
User | Count |
---|---|
92 | |
59 | |
59 | |
49 | |
41 |