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
Anonymous
Not applicable

DAX Formula to Return Second Date Based on Other column

My data is as shown below, I want to record date of second sales made by a salesperson in another column. Here Mathew has made two sales on same day, so second sales should be marked in another column. 

 

bharathsurya_1-1637251699554.png

 

 

Help to find dax for the same.
Thanks in advance.

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated column.

rank = RANKX(FILTER(ALL('Table'),'Table'[SalesPerson]=EARLIER('Table'[SalesPerson])),[Sl No],,ASC)
Second Sales Date =
var _1=CALCULATE(MAX('Table'[Sales Date]),FILTER(ALL('Table'),'Table'[rank]=2&&'Table'[SalesPerson]=EARLIER('Table'[SalesPerson])))
return
IF(
    [rank]=2,_1,BLANK())

2. Result:

vyangliumsft_0-1637631078730.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated column.

rank = RANKX(FILTER(ALL('Table'),'Table'[SalesPerson]=EARLIER('Table'[SalesPerson])),[Sl No],,ASC)
Second Sales Date =
var _1=CALCULATE(MAX('Table'[Sales Date]),FILTER(ALL('Table'),'Table'[rank]=2&&'Table'[SalesPerson]=EARLIER('Table'[SalesPerson])))
return
IF(
    [rank]=2,_1,BLANK())

2. Result:

vyangliumsft_0-1637631078730.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

VahidDM
Super User
Super User

HI @Anonymous 

 

Try this:

 

Column =
VAR _D =
CALCULATE ( MAX ( [Made Sales On] ), ALLEXCEPT ( table, table[SalesPerson] ) )
RETURN
IF ( [Made Sales On] = _D, _D, BLANK () )


 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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