Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help with Calendar Week Numbers - No Date

Hello,    I have a dataset that provides the calendar week number (i.e. 1 thru 52) and the year. With this data I am facing two issues. First, I have visuals with the week numbers as the x-axis val...
  • v-jianboli-msft's avatar
    4 years ago

    Hi Anonymous ,

     

    Based on your description, I have created a simple sample:

     

    Please try:

    Column =
    VAR _a =
        AVERAGEX (
            FILTER (
                'Rolling Table',
                [Index] <= EARLIER ( 'Rolling Table'[Index] )
                    && [Index]
                        > EARLIER ( 'Rolling Table'[Index] ) - 4
                    && [Year] = EARLIER ( 'Rolling Table'[Year] )
            ),
            [CFS]
        )
    VAR _b =
        IF (
            [Index] >= 4,
            _a,
            AVERAGEX (
                FILTER (
                    'Rolling Table',
                    ( [Year] * 100 + [Index] )
                        > (
                            ( EARLIER ( 'Rolling Table'[Year] ) - 1 ) * 100 + 48
                                + EARLIER ( 'Rolling Table'[Index] )
                        )
                        && ( [Year] * 100 + [Index] )
                            <= (
                                EARLIER ( 'Rolling Table'[Year] ) * 100
                                    + EARLIER ( 'Rolling Table'[Index] )
                            )
                ),
                [CFS]
            )
        )
    RETURN
          _b
    

    change the format:

     

    Output:

     

    Then apply it to the visual:

     

    Final output:

     

    Best Regards,

    Jianbo Li

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