Forum Discussion

NanDeb's avatar
NanDeb
Helper I
3 years ago
Solved

Filter context and Matrix Visual - Weekly average for selected period

Hi, I am  fairly new to power BI  and have a problem I cannot solve, Ihave searched the boards and can't find a solution.    I would like to display the weekly sales average for a selected period i...
  • NanDeb's avatar
    3 years ago

    Solved:

    I had to remove the filters from the calendar so that the calculation could be done over the full set of weeks but retain them for time period selected.  

    CALCULATE(
        AVERAGEX(
            SUMMARIZE(
                ALLSELECTED('Calendar'),
                'Calendar'[WeekEnding]
                ),
            [Sales Period Selected]
    ),  REMOVEFILTERS('Calendar'),
       KEEPFILTERS('Time Period Selector'[Time Period] = SELECTEDVALUE('Time Period Selector'[Time Period])
    )
    )