Forum Discussion
ranking
I need to rank sellers based on a field that is not being filtered in the visual, just by the team that the seller belongs. It's a report made to the seller, so he must see his position among sellers on the same team. Each seller can have more than one account, that's my lowest level of glanularity.
I was able to solve the seller position in all teams, but not in his own team.
Here is the last dax i tried:
CALCULATE(
RANKX(
ALL(account[seller]),
[sales_amount]
,,, Dense
),
KEEPFILTERS(fact[store_id]),
ALLSELECTED(account[team], account[cluster])
)
5 Replies
- FreemanZSuper User
not sure if i fully get you.
supposing you have table like this:
Team Seller Sales A A1 1 A A2 2 B B1 1 B B2 2 B B3 3 try to plot a measure with columns [team] and [seller] and a measure like:
RankingMeasure = RANKX( FILTER( ALL(TableName), TableName[Team] = MAX(TableName[Team]) ), CALCULATE(SUM(TableName[Sales])), ,ASC )or
RankingMeasure2 = RANKX( CALCULATETABLE( TableName, ALLEXCEPT(TableName, TableName[Team]) ), CALCULATE(SUM(TableName[Sales])), ,ASC )it worked like:
- daniel_ricardoFrequent Visitor
Yes, your suggestion works in a table, but i'm using that measure in a card. In table, i think in some way we have a implicity filter behavior, because the team column is there (sorry if I'm saying something wrong). In my report I have a filter by seller, and the team is not filtered. I tested here and in this scenario it didn't work.
- FreemanZSuper User
try to provide some sample data?
- FreemanZSuper User
or you add a calculated column like:
RankingColumn = RANKX( FILTER( TableName, TableName[Team] = EARLIER(TableName[Team]) ), TableName[Sales], ,ASC )it worked like: