Show Top Salesperson

Hello everyone,
I have a Measure which shows me the top salesman of a customer. This works very well in a visualization. I would like to calculate this now in a calculated column and there is only one salesperson for all customers. Does anyone have an idea how I can set the context in the calculated column correctly?

My Measure is
    main-sales-people = 
        SUMMARIZE('Customer Sales';'Customer Sales'[Sales People];"main sales people"; [Total Days Transactions]);
        [main sales people]);
        'Customer Sales'[Sales People])

I need the context for each customer

I used to do this project before. And I used this video created by Sam. I recommend using this:

1 Like

Thanks, for your response but this is Not the Right Solution for me. My Measure works Fine in a visualisation. I need the top salespeople in a slicer as filter in a calculated column

I don’t think you can use a measure as a slicer. Have you tried MAX instead of MAXX?.

If you want to rank within a calculated column you need to use RANKX. And you’re formula would be relatively simple here. Just using the main parameters within RANKX. That’s it.

TOPN returns a table and is not appropriate for use generally within calculated columns.

Also I feel from a visual perspective you can probably get what you need using measures here instead of calculated columns.

Maybe add a demo pbix file with what you are trying to showcase and more specific assistance could be offered on it.


Hi @Mario, we’ve noticed that no response has been received from you since the 10th of April. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!

Hey Sam, i used the measur in a visualisation an it works fine. The formula is the same as in your post.

I need it in a calculated column to use the values in a slicer as filter. in example in my case, i will filtering for a salesperson and showing only the customers where he is the top salesperson.
Do you have an idea how i can used in a slicer as filter?

Hello, I have tested a little. With the RankX function the visualization works the values are displayed in the visualization, but in the calculated column the function behaves differently.
here my measures:
RankedSalespeople = RANKX(ALL('Sales People'[Sales People]);[Total Days Transactions];;DESC)

SalespeopleName = CALCULATE(SELECTEDVALUE('Sales People'[Sales People]);FILTER(VALUES('Sales People'[Sales People]);[RankedSalespeople]=1))

And this is how the measures in the calculated column behave

Yes that’s correct. RANKX works very differently in a calculated column due to the original content of the calculation.

I would recommend using measures here. There is no need to use calculated columns for logic like this.

Always look to use measures whereever possible.

Here’s a really detailed workshop on ranking techniques including RANKX. A really good one to go through for this.


Sorry I overlooked your use case.

For the calculated column try a technique similar to this

    FILTER (
        Table[Column] = EARLIER ( Table[Column] )

The EARLIER function is what you usually need in the calculated column to make it work.

Try this.


1 Like

Hi, thanks for this recommendation. I have testes a bit and i think a calculated column is not the right solution for my case. I would like to be able to filter by the salesperson so that the customers are displayed where he is stored as a top sales person.
like in the mockup
Do you have an idea?

Thanks to the contributors of this post. Due to the length by which this post has been active, we are tagging it as Solved. For further questions related to this post, please make a new thread.

Does anyone have an idea how to solve this case?