Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm trying to create a table showing who is the salesperson with more affinity with the client.
For that:
- 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.
Help 🙂
Solved! Go to Solution.
Please try this MEASURE
Desired SalesPerson = VAR myTable1 = TOPN ( 1, SUMMARIZE ( SalesTable, SalesTable[Salesperson_ID], "Count", COUNT ( SalesTable[Salesperson_ID] ) ), [Count], DESC ) VAR myTable2 = TOPN ( 1, SUMMARIZE ( SalesTable, SalesTable[Salesperson_ID], SalesTable[Date] ), SalesTable[Date], DESC ) VAR MostOrders = CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable1 ) VAR LastOrder = CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable2 ) RETURN IF ( COUNTROWS ( mytable1 ) = 1, MostOrders, LastOrder )
Please try this MEASURE
Desired SalesPerson = VAR myTable1 = TOPN ( 1, SUMMARIZE ( SalesTable, SalesTable[Salesperson_ID], "Count", COUNT ( SalesTable[Salesperson_ID] ) ), [Count], DESC ) VAR myTable2 = TOPN ( 1, SUMMARIZE ( SalesTable, SalesTable[Salesperson_ID], SalesTable[Date] ), SalesTable[Date], DESC ) VAR MostOrders = CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable1 ) VAR LastOrder = CALCULATE ( LASTNONBLANK ( SalesTable[Salesperson_ID], 1 ), mytable2 ) RETURN IF ( COUNTROWS ( mytable1 ) = 1, MostOrders, LastOrder )
Thanks!!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
77 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |