Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |