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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
uc
Helper II
Helper II

Help with filtering dates

Hello

 

I have two tables namely Contacts and Sales as shown in the example below. I wanted to create a calculated column (Contact after sales date) in Sales table such that only the immediate contact date after the sales date is pulled for each key as shown below.  Can anyone suggest the code that could be used achieve this please? Thanks in advance. 

 

Contact DateKey
01/01/20221
16/01/20222
08/01/20223
29/01/20224
15/01/20221
02/02/20224
19/01/20223
30/01/20222

 

Sales DateKeyContact after Sales date
09/01/2022115/01/2022
24/01/2022230/01/2022
07/01/2022308/01/2022
28/01/2022429/01/2022
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @uc 

 

Try this code to add a new column with dax:

Contact after Sales date = 
CALCULATE (
    MIN ( Contacts[Contact Date] ),
    Contacts[Contact Date] > EARLIER ( Sales[Sales Date] )
)

 

Output:

VahidDM_0-1656630529048.png



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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @uc 

 

Try this code to add a new column with dax:

Contact after Sales date = 
CALCULATE (
    MIN ( Contacts[Contact Date] ),
    Contacts[Contact Date] > EARLIER ( Sales[Sales Date] )
)

 

Output:

VahidDM_0-1656630529048.png



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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Thankyou so much 🙂

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.