Search code examples
powerbidaxpowerbi-desktopdaxstudio

DAX: Min(Start_date) based on previous date


Please lend your hand to resolve my issue facing in DAX logic.

Table

enter image description here

I need enter image description here

I don't know how to proceed with Dax could you please share me your ideas

Edit2: What if my data is like this enter image description here Batches -B will start on day 1 and complete on next day

Thank you for reading. BI_seeker


Solution

  • Here you go :

    Min_Start_Date = CALCULATE(MIN('Table'[Start_Date]),FILTER('Table','Table'[Batches] = EARLIER('Table'[Batches])))
    
    Max_End_Date = CALCULATE(MAX('Table'[End_Date]),FILTER('Table','Table'[Batches] = EARLIER('Table'[Batches])))
    

    Hope this solves your query enter image description here