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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Monicam
Frequent Visitor

DAX - Date before

I am attempting to pull the date of the 101 Movement type that comes directly before a 102 movement.

 

I have no issues determining the Max date for an order # by movement type however cannot for the life of me determine how through DAX to pull the Maximum Date for Movement Type = 101 that comes before the 102 Movement Type.  Below is an example of my data.

 DAXHelp.png

Thank you

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Create a measure with:

a variable that holds the date of the type = 102 record-> _102Date

 

Return the largest date from the filtered table of type = 101 and PostingDate < _102Date

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Is this going to be a measure or a calculated column? And if a measure, then what will happen if there are many different orders visible in the context? How to decide which date to return?
HotChilli
Super User
Super User

Create a measure with:

a variable that holds the date of the type = 102 record-> _102Date

 

Return the largest date from the filtered table of type = 101 and PostingDate < _102Date

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors