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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
TonyR
Frequent Visitor

Last SoldBy salesperson

Hi,

Based on the simple table table structure below can some show me an example of the dax forum that will show which salesperson last sold to that customer. It would be added as a column\measure to the customer table.

Thank you

Tony

 

 

 

2017-03-27_17-20-34.png

 

 

Invoice 

 

 

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@DoubleJ

 

Hi, my alternative solution would be a measure like this:

 

LastSoldBy =
CALCULATE (
    VALUES ( Sales[SalesPerson] ),
    FILTER ( RELATEDTABLE ( Sales ), Sales[InVDate] = MAX ( Sales[InVDate] ) )
)

 




Lima - Peru

View solution in original post

3 REPLIES 3
DoubleJ
Solution Supplier
Solution Supplier

Hi

 

I think a new column with this formula should do what you want:

 

LastSoldBy = LOOKUPVALUE(
    Sales[SalesPerson];
    Sales[InvDate];MAXX(RELATEDTABLE(Sales);Sales[InvDate]);
    Customers[CustomerID];Customers[CustomerID]
    )

 

I am sure there's a better solution and I am curious to see it myself. Anyway, I hope this helps for now.

 

JJ

Vvelarde
Community Champion
Community Champion

@DoubleJ

 

Hi, my alternative solution would be a measure like this:

 

LastSoldBy =
CALCULATE (
    VALUES ( Sales[SalesPerson] ),
    FILTER ( RELATEDTABLE ( Sales ), Sales[InVDate] = MAX ( Sales[InVDate] ) )
)

 




Lima - Peru

Hi Victor 

 

Thanks for sharing, your solution probably is faster!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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