Forum Discussion

coast2coast's avatar
coast2coast
New Member
2 years ago
Solved

DATESINPERIOD based on dynamic date range AND second dynamic criteria

Hello - this is my first post here and I am new to PowerBI, so please bear with me 🙂 Thank you!   I am trying to dynamically sum a value based on a changing date range (3 weeks +/- current row dat...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi coast2coast ,

    Below is my table:

    The following DAX might work for you:

     

    Measure = 
     var result = 
      CALCULATE(
        SUMX('Table' , 'Table'[Days]),
        DATESINPERIOD('Table'[Week], MIN('Table'[Week]) , 21, DAY )
    )
    return result
    

     

    The final output is shown in the following figure:

    Best Regards,

    Xianda Tang

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