I have a measure to generate a ranking on the clients, I need it to take into account the positive and negative values, with the measure I have I manage to take both values but the rank value is not correct, instead of going 1,2,3 ,…etc., starts with 2 ,145,146,…,etc.
I add the measurement and the data sample that I have as well as the output obtained.
I hope you can help me. Thanks ¡¡
Top N Customer =
VAR PositiveRanks =
RANKX(
FILTER(
ALL(SPEND_ANALYSIS[Customer Name]),
[Amount] >= 0
),
[Amount],
,
DESC
)
VAR MaxPositiveRank = COUNTROWS(FILTER(ALL(SPEND_ANALYSIS[Customer Name]), [Amount] >= 0))
RETURN
IF([Amount] >= 0,
PositiveRanks,
MaxPositiveRank + RANKX(
FILTER(
ALL(SPEND_ANALYSIS[Customer Name]),
[Amount] < 0
),
[Amount],
,
DESC
)
)
enter image description here
New contributor
Sara is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.