Forum Discussion

Velocity's avatar
Velocity
Icon for Helper III rankHelper III
6 years ago
Solved

Can I use a Measure in Filter?

Hi, In my data table, i have many records with future dates. I would like to restrict my slicer to show dates up to last week's beginning date. I have created a measure cutoff date = today() - (wee...
  • rajulshah's avatar
    6 years ago

    Hello Velocitym,

     

    You can use a measure as 'Visual Level Filter'. However you can create a calculated column in the date table that returns zero for the days that you don't want to count in the measure.

     

    On the basis of what I think your requirement is, I have created a calculated column as below:

     

    Last Week StartDay = 
    VAR CurrentWeek =  WEEKNUM(TODAY())
    VAR LastWeek = CurrentWeek-1
    VAR LastWeekBeginningDate = CALCULATE(FIRSTDATE('Date'[Date]),FILTER('Date',WEEKNUM('Date'[Date])=LastWeek))
    RETURN IF(WEEKNUM('Date'[Date])>=LastWeek && 'Date'[Date]>LastWeekBeginningDate,1,0)

     

    And you can use this colujmn to filter out the dates, as LastWeekStartDay<>1.

    You can modify the start of the day as you want. I have taken the default start of the week.
    Hope this helps. Please let me know if this doesn't work.