cancel
Showing results for
Search instead for
Did you mean:
Member

## Average of previous week total blank

Hi,

Have an issue with following.

Can calculate at row level, previous weekly compliance figure for a store as shown below.

The weekly compliance figure in bold below is an average figure

CALCULATE(AVERAGEX('Sales','Sales'[Weekly Compliance])

Previous Weekly compliance defined as below

CALCULATE(AVERAGEX('Sales','Sales'[Weekly Compliance]) ,filter(all
(calendar),calendar[Week End Date]=maxX(calendar,calendar[Week End Date])-7) )

Both mesaures abiove defined as percentage but the previous weekly compliance giving blank at total level.

Then will compare average weekly compliance figure to previous week average weeklyu compliance figure at level of all stores to then show in card along with arrow as to whther increased or decreased.

How can we get an average for the previous weekly total figure to show correctly?

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Average of previous week total blank

Very tough without sample data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

If I am reading this correctly, you are looking to calculate your AVERAGEX calculation where your [Week End  Date] = the MAX [Week End Date] - 7 days. Knowing that the Total line calculates in the context of ALL, you would therefore be returning your maximum date from that table and the logic would be that you don't have a [Week End Date] that is exactly 7 days less than that.

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

2 REPLIES 2
Super User

## Re: Average of previous week total blank

Very tough without sample data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

If I am reading this correctly, you are looking to calculate your AVERAGEX calculation where your [Week End  Date] = the MAX [Week End Date] - 7 days. Knowing that the Total line calculates in the context of ALL, you would therefore be returning your maximum date from that table and the logic would be that you don't have a [Week End Date] that is exactly 7 days less than that.

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Highlighted
Member

## Re: Average of previous week total blank

Thanks for reply and explanation.

Have changed to instead get the value for max date -7 and this will be the constant value which is then compared to the dynamic value of selection and working as expected now.