Forum Discussion

elliottriley's avatar
elliottriley
Frequent Visitor
7 years ago
Solved

Creating dynamic measures using a slicer to change date values

We have a fact table that shows one row per visit.  Against each visit is a date, visitID, an outletID, outletname and some other numbers.   What we want to do is use a slicer to specify a date ran...
  • Greg_Deckler's avatar
    7 years ago

    This may be what you have already but if you have a table with OutletID in it then you could calculate the last date as follows:

     

    Measure = 
    VAR __maxDate = MAX([Date])
    RETURN
    MAXX(FILTER('Table',[Date]<=__maxDate),[Date])

    The thought here is that if you have OutletID in the table, then your fact table is already constrained by OutletID for each row in the table. So you just need to find the MAXX of the Date for that already filtered (context) table.