Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Rolling Date Range

Hi,   I'm attempting to create  rolling date range, however, the basic statement I' m using to pull back the prior 7 days worth of data keeps giving an error. I would truly appreciate any assistanc...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Based on your description, you can modify the function as follows.

     

    {Cube.ApplyParameter, "DateRange",
    List.Dates(Date.AddDays(Date.From(DateTime.LocalNow()),-8),7,#duration(1,0,0,0))},
    {Cube.AddAndExpandDimensionColumn, "DateGranularity", {"year", "month", "day", "hour"}, {"Date Granularity.Level 1: Year", "Date Granularity.Level 2: Month", "Date Granularity.Level 3: Day", "Date Granularity.Level 4: Hour"}},
    {Cube.AddAndExpandDimensionColumn, "evar2", {"evar2"}, {"Platform (v2)"}},
    {Cube.AddMeasureColumn, "Unique Visitors", "uniquevisitors"}
    })
    in
    #"Added Items"
     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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