Forum Discussion

ghutchins's avatar
ghutchins
Helper II
3 years ago
Solved

Calculate Min Values within a Specific and Dynamic Date Range

I have created a static version of a date range by repeatedly using a data field in the visual filters but want to write a DAX expression to do the same thing and be dynamic.  What I am trying to do ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Would you try this : FY End Date = EOMONTH(TODAY(),-1) - 7

    This should calculate the end date dynamically

    And then use the updated formula in the CALCULATE function:

    Test Column = CALCULATE(MIN('Table'[zValus]), 'Table'[RP] > [FY Start Date] && 'Table'[RP] < [FY End Date])

  • ghutchins's avatar
    3 years ago

    Sincere thanks Anonymous !  Although your code was not exactly what I needed, it was enough to get me where i needed to be.  I will see if it does what I think it will next week.  Counting that as a solution for you.  This is what I ended up using to limit my data dynamically.

    End Date Filter (T/F) = 'Table'[RP] <= EOMONTH(DATE(YEAR(TODAY()),MONTH(TODAY()),7),-2)
    //  Looking at the reporting period (RP) entered on the form...  RP is less than or equal to the current year and month two months before the 7th of month...  after the 7th of this month the data ends on the prior month.