I'm trying to create a table showing who is the salesperson with more affinity with the client.
- Whoever had more orders from the client is "assigned" to the client.
- In case of a tie, the salesperson who did the last order is.
Go to Solution.
Please try this MEASURE
Desired SalesPerson =
VAR myTable1 =
"Count", COUNT ( SalesTable[Salesperson_ID] )
VAR myTable2 =
SUMMARIZE ( SalesTable, SalesTable[Salesperson_ID], SalesTable[Date] ),
VAR MostOrders =
CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable1 )
VAR LastOrder =
CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable2 )
IF ( COUNTROWS ( mytable1 ) = 1, MostOrders, LastOrder )
View solution in original post
Check out the on demand sessions that are available now!
Check out the Winners!
Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.