Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

This week date measure

Hi , can we create a measure to return all the dates that belongs to this week ? and last year same week ?    this week dates = var todaydate = TODAY() var startdate= CALCULATE(SUM(DimTimeCale...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I think you want the matrix to show the values for this week and the previous week.

    Here's my solution.

    1.Create a calendar table.

    Calendar = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

     

    2.Create a measure, put it into visual level filters and set show items when the value is 1.

    Measure = var _thisweek=WEEKNUM(TODAY(),2)
    var _week=WEEKNUM(MAX('Calendar'[Date]),2)
    return IF(_thisweek=_week||_thisweek-1=_week,1)

     

    As shown above, the view shows the data for this week and the previous week.

     

    Best Regards,

    Stephen Tao

     

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