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.
Hi there,
I am, for the first time, using RANKX for reporting different data both in a descending and an ascending way.
I've had no issues with DESC, but for some reason ASC always starts at 2. It seems that everything else that's in my DimBusiness table, that I'm not interested in/is filtered out, becomes a 1. I don't know how to manage it. Obviously my filters are wrong.
I'm using this:
Ranking Ave =
RANKX( ALL(DimBusiness[BusinessName]), CALCULATE( [Weighted Ave],
KEEPFILTERS( DATESBETWEEN( Dim[CalendarDate], [ReportingStartDate], [ReportingEndDate] ) ) ),
, ASC, DENSE )
Others have had the same issues, but I can't wrap my head around it. Help much appreciated.
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please try something like below.
Ranking Ave =
VAR _t =
FILTER ( ALL ( DimBusiness[BusinessName] ), ( NOT [Weighted Ave] = 0 ) )
RETURN
RANKX (
_t,
CALCULATE (
[Weighted Ave],
KEEPFILTERS (
DATESBETWEEN ( Dim[CalendarDate], [ReportingStartDate], [ReportingEndDate] )
)
),
,
ASC,
DENSE
)
Hi,
I am not sure if I understood your question correctly, but please try something like below.
Ranking Ave =
VAR _t =
FILTER ( ALL ( DimBusiness[BusinessName] ), ( NOT [Weighted Ave] = 0 ) )
RETURN
RANKX (
_t,
CALCULATE (
[Weighted Ave],
KEEPFILTERS (
DATESBETWEEN ( Dim[CalendarDate], [ReportingStartDate], [ReportingEndDate] )
)
),
,
ASC,
DENSE
)
This seems to have worked. Thanks very much.
Are you able to explain what the issue was?
Hi,
I tried to create a virtual table, inside the measure, that does not contain zero value of [Weighted Ave]. And then, I tried to rank among the virtual table.
If you want to change the condition, you can try altering the below part.
VAR _t =
FILTER ( ALL ( DimBusiness[BusinessName] ), ( NOT [Weighted Ave] = 0 ) )
I hope this explains.
Thank you.
Hi @greenskmachine2 ,
the reason could be the presence of blank values in your measure [Weighted Ave]. please share sample data if possible
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 |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |