Forum Discussion

vnanduri's avatar
vnanduri
Frequent Visitor
6 years ago
Solved

Set flags for Fridays

Hi Team,   I have a query as below,   My dataset has only Friday dates, So my question is, the most recent friday should be numbered as zero and the preceding fridays should be numbered -1, -2......
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi vnanduri ,

    You can create a calculated column as below:

    Flag = 
    VAR Sweek =
        'Date'[Date] - WEEKDAY ( 'Date'[Date], 2 ) + 1
    VAR Cweek =
        TODAY () - WEEKDAY ( TODAY (), 2 ) + 1
    RETURN
        ( Sweek - Cweek ) / 7 + 1

    Best Regards

    Rena