The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |