Forum Discussion

nasbkrv's avatar
nasbkrv
Regular Visitor
5 years ago
Solved

Last week formula

Hi, I have a report page with slicers for Year, Week from-To, Last week. But I have an issue with my Last Week formula and the interaction with the Year filter. Last week formula is:  IF (Y...
  • V-lianl-msft's avatar
    5 years ago

    Hi nasbkrv ,

     

    Please create Year_Week column as filter condition first.

     

    Year_week = 'Table'[week]+'Table'[year]*100

     

    Then create Last week column:

     

    IsLastWeek2 = 
    var current_date = CALCULATE(
        MIN('Table'[Date]),
        FILTER('Table',
        'Table'[Year_week]=MAX('Table'[Year_week]))
        )
    return 
    IF('Table'[Date]<current_date&&
        'Table'[Date]>=current_date-7,
    "Yes",
    "No")

     

     

    Sample .pbix

     

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