Forum Discussion

Monicam's avatar
Monicam
Frequent Visitor
5 years ago
Solved

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.

 

Thank you

  • 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

     

     

2 Replies

  • Anonymous's avatar
    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's avatar
    HotChilli
    Icon for Community Champion rankCommunity Champion

    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