Forum Discussion

apvu2's avatar
apvu2
Icon for Helper I rankHelper I
4 years ago
Solved

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. 

ClientDaily revenue
Target100
Big Lots150
Big 5200

 

 

ClientSales Person
TargetJon
TargetMike
TargetJohnson
Big 5Mike
Big LotsJohnson
Big LotsMike

 

 

  • apvu2 , Try like

     

    Divide(sum(Table1[Daily revenue]), calculate(sum(Table1[Daily revenue]), all(table2[sales person]) ) )

3 Replies