Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

latest sales rep

Hi guys

I am looking for solution on the following issue

I have a sales table with cst, sales rep, order cration date and amount
Over the years the sales rep who was responsible for certain customers changed ( the sales rep left or got different customers)
I would like to find out who is the last sales rep that placed an order for cst A, B, ect
I was thinking about these steps

Create a table whith all unique customers, add column which will calculate the latest order date per ech customer and then create another column or measure that will use the latest order date as a filter to decide which sales rep to choose

Please can you help me with this

Thank you very much
1 ACCEPTED SOLUTION

Hey,

sorry for the late response. Use calculated Table under --> Data-->modeling->New Table

 

LastReps = DISTINCT(Table1[Customer #])

Add Columns

 

 

LastDate = CALCULATE(MAX(Table1[Last order date]);FILTER(Table1;Table1[Customer #]=LastReps[Customer #]))
SalesRep = LOOKUPVALUE(Table1[Sales Rep];Table1[Customer #];LastReps[Customer #];Table1[Last order date];LastReps[LastDate])

There are other ways too, but I think this is the most comprohensive

 

 

View solution in original post

5 REPLIES 5
WolfBiber
Employee
Employee

Hey,

do you have a fact tables and dimensions?

Can you show us some example data?

 

thx

Anonymous
Not applicable

@WolfBiber

 

and here is a sample 

 

Customer #Sales RepLast order date
1018574tim9/21/2017
1018574alex9/22/2017
1017640dirk1/12/2018
1017640pit8/23/2017
1017640john10/24/2017
1020601kris1/11/2018
1020601michael12/15/2017
1015972Lisa1/11/2018
1015972carsten1/15/2018
1015972maria9/4/2017
1015972tom12/28/2017
1015981carsten11/13/2017
1015981niels1/15/2018
1020722jenny12/1/2017
1020722peter1/4/2018

 

 

which i would like to trasfer to new table which will show me this 

 

1018574alex
1017640dirk
1020601kris
1015972carsten
1015981niels
1020722peter

 

 

meaning dynamic sales rep/cst table based on last order date

 

Hope this makes it clear 

 

Thanx 

 

 

 

 



Hey,

sorry for the late response. Use calculated Table under --> Data-->modeling->New Table

 

LastReps = DISTINCT(Table1[Customer #])

Add Columns

 

 

LastDate = CALCULATE(MAX(Table1[Last order date]);FILTER(Table1;Table1[Customer #]=LastReps[Customer #]))
SalesRep = LOOKUPVALUE(Table1[Sales Rep];Table1[Customer #];LastReps[Customer #];Table1[Last order date];LastReps[LastDate])

There are other ways too, but I think this is the most comprohensive

 

 

Hello my friend i tried to use above SaleRep Dax but i got this error A table of multiple values was supplied where a single value was expected.

I have created new table for Customer ID and last order date now i need last sales representative for each customer.

Lalji_0-1697776883531.png

My other table is as below

Customer #Sales Representative NameEntry Date
3A17/04/2019
3B29/06/2021
1121AA14/02/2016
1121BB15/02/2016
1AAA5/10/2023
1BBB2/10/2023
1199AAAA16/10/2023
1199BBBB18/10/2023

 

Result should be

Customer #Sales Representative NameEntry Date
3B29/06/2021
1121BB15/02/2016
1AAA5/10/2023
1199BBBB18/10/2023

 

Anonymous
Not applicable

@WolfBiber

Lets asume that i only have fact table and i am trying to create dimension table where i want to have only one sales rep per cst and that should be the last one placing order

thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.