Forum Discussion

MalavikaUB's avatar
MalavikaUB
New Member
2 years ago
Solved

Rolling 13 periods without a structured date column

Hi, I would need help with rolling 13 period.  I have these columns from the table - FiscalYear and FiscalPeriod, Revenue. And not a date column. The requirement is to show the Revenue for the Rolli...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi MalavikaUB ,

    Please try this way:
    Use this DAX to create a new measure:

    SelectedFlag = 
    VAR Current_Year = SELECTEDVALUE(CurrentYear[CurrentYear])
    VAR Current_Period = SELECTEDVALUE(CurrentPeriod[CurrentPeriod])
    VAR CurrentPeriodNumber = (Current_Year * 100) + Current_Period
    VAR MinPeriodNumber = CurrentPeriodNumber - 100
    RETURN
    IF(
        NOT ISBLANK(Current_Year) && NOT ISBLANK(Current_Period),
        IF(
            (SELECTEDVALUE('Table'[FiscalYear]) * 100 + SELECTEDVALUE('Table'[FiscalPeriod])) > MinPeriodNumber && 
            (SELECTEDVALUE('Table'[FiscalYear]) * 100 + SELECTEDVALUE('Table'[FiscalPeriod])) <= CurrentPeriodNumber,
            1,
            0
        ),
        BLANK()
    )

    The results are shown below:

     

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