Forum Discussion
Divide when slicer is slected
So I have two data sets one is my master table, table X, which contains a client name and a daily revenue. then have another table, table Y that contains salesmen who worked on this client. I have a reationship netween the two tables linled by Client. I am then using splicers to splice the Sum of revenue to see which salesmen generated what revenue, etc. What I am trying to do is when lets say salesmen "Abe" is selcted I want the total revenue to be split between him and whoever esle worked on that client. I tried doing a distinct count and dividing that way, but it only works correctly when a salemen is selected and when none are the total revenue is incorect as it divides by the entire count of distinct rows. example tab;e are shown below. So if I splice it my the sales person Johnson it shoud show on my Matrix table it should show the Clinet target as that is essentailly the only Client he worked on, and the Revenue should show $100/3 = $33.33 since there wwre 3 individuals working on target so the revenue is split.
| Client | Daily revenue |
| Target | 100 |
| Big Lots | 150 |
| Big 5 | 200 |
| Client | Sales Person |
| Target | Jon |
| Target | Mike |
| Target | Johnson |
| Big 5 | Mike |
| Big Lots | Johnson |
| Big Lots | Mike |
apvu2 , Try like
Divide(sum(Table1[Daily revenue]), calculate(sum(Table1[Daily revenue]), all(table2[sales person]) ) )
3 Replies
- amitchandak
Super User
apvu2 , Try like
Divide(sum(Table1[Daily revenue]), calculate(sum(Table1[Daily revenue]), all(table2[sales person]) ) )
- apvu2
Helper I
It works, for the totals, but it does not update the numbers for the total revenue inside the matrix for the clients.