Forum Discussion
Compare two dates to create flag
Hello all,
I am looking at a solution to identify if there exists ML_date before Escalation_Date by each Serial number.
In the below table, for Serial_Number:100 , Escalation_Date is 3/2/2023 but the minimum ML_Date is 3/3/2023 which is after Escalation Date and hence "No" in the last coulmn.
For Serial_Number:200 , Escalation_Date is 4/1/2023 but the minimum ML_Date is 4/1/2023 which is on or before Escalation Date and hence "Yes".
| Serial_Number | Escalation_Date | ML_Date | Data_Available_On_Before_Escalation |
| 100 | 3/2/2023 | 3/5/2023 | No |
| 100 | 3/2/2023 | 3/4/2023 | No |
| 100 | 3/2/2023 | 3/3/2023 | No |
| 200 | 4/1/2023 | 4/2/2023 | Yes |
| 200 | 4/1/2023 | 4/1/2023 | Yes |
| 300 | 4/11/2023 | 4/8/2023 | Yes |
| 300 | 4/11/2023 | 4/7/2023 | Yes |
| 300 | 4/11/2023 | 4/6/2023 | Yes |
| 400 | 5/1/2023 | 5/4/2023 | No |
| 400 | 5/1/2023 | 5/3/2023 | No |
| 400 | 5/1/2023 | 5/2/2023 | No |
Hi,
try a calculated column with this DAX:
Column = var _mindate = CALCULATE(min('Table'[ML_Date]),ALLEXCEPT('Table','Table'[Serial_Number]))returnif ('Table'[Escalation_Date] < _mindate, "No", "Yes")If I answered your question, please mark my post as solution, Appreciate your Kudos 👍Hi,
you can add a calculated column
Column =VAR currser = 'Table'[Serial_Number]
VAR minMLdate = CALCULATE( MIN('Table'[ML_Date]), FILTER('Table', 'Table'[Serial_Number]=currser ))RETURNIF( 'Table'[Escalation_Date] >= minMLdate, "yes", "no" )If this post is useful to help you to solve your issue consider giving the post a thumbs up
and accepting it as a solution !
3 Replies
- DOLEARY85Resident Rockstar
Hi,
try a calculated column with this DAX:
Column = var _mindate = CALCULATE(min('Table'[ML_Date]),ALLEXCEPT('Table','Table'[Serial_Number]))returnif ('Table'[Escalation_Date] < _mindate, "No", "Yes")If I answered your question, please mark my post as solution, Appreciate your Kudos 👍 - serpiva64Solution Sage
Hi,
you can add a calculated column
Column =VAR currser = 'Table'[Serial_Number]
VAR minMLdate = CALCULATE( MIN('Table'[ML_Date]), FILTER('Table', 'Table'[Serial_Number]=currser ))RETURNIF( 'Table'[Escalation_Date] >= minMLdate, "yes", "no" )If this post is useful to help you to solve your issue consider giving the post a thumbs up
and accepting it as a solution !
- prasadhebbar315Advocate I