Forum Discussion

daniel_ricardo's avatar
daniel_ricardo
Frequent Visitor
3 years ago

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

  • hi daniel_ricardo 

    not sure if i fully get you. 

    supposing you have table like this:

    TeamSellerSales
    AA11
    AA22
    BB11
    BB22
    BB33

     

    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_ricardo's avatar
      daniel_ricardo
      Frequent 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.

  • or you add a calculated column like:

    RankingColumn = 
    RANKX(
        FILTER(
            TableName,
            TableName[Team] = EARLIER(TableName[Team])
        ),
        TableName[Sales],
        ,ASC
    )

     

    it worked like: