cancel
Showing results for
Did you mean:
Regular Visitor

## Average on the last week

Hi,

I want to create a measure with a division :

- numerator = backlog

-denominator = the average of the number created ticket of the last week (the calculation = all the creation of the week divided by 5)

My issue is on the denominator, I have some difficulties to create it. I don't know how can I create an weekly average.

Can you help me on that point ?

Sincerely

5 REPLIES 5
Member

## Re: Average on the last week

Assuming you have a date field along with each entry you can use a calculate function with filters to say the date created should be greater than today()-5 and less than today().

Hope this helps

Thanks,

George

Regular Visitor

## Re: Average on the last week

Hi,

First thank you for your help.

Secondly, I try this :

Avg creation weekly =
CALCULATE (
AVERAGEX( 'All detail';[Nb ticket]);'All detail'[Inc Date Creation]>= TODAY()-5 && 'All detail'[Inc Date Creation]<TODAY()
)

But all the result are = 1,00

Measure ''Nb ticket''  = count(N°Ticket)

I dont understand why I always have this result...
Regular Visitor

## Re: Average on the last week

I found a way to calculate the average of the week (http://radacad.com/week-to-date-calculation-in-power-bi-with-dax) :

Week avg bis =
var CurrentDate=LASTDATE('Date bis'[Date])
var DayNumberOfWeek=WEEKDAY(LASTDATE('Date bis'[Date]);3)
return
CALCULATE(DIVIDE([Nb ticket];5);
DATESBETWEEN(
'Date bis'[Date];
CurrentDate;
-1*DayNumberOfWeek;
DAY);
CurrentDate))

I want the average of the last week, for example if I am in the 25th week of the year I want the average of the 24th week.

So can you help me to modify this measure for do that please ?
Regular Visitor

## Average of the last week

Hi all,

I want to create a  measure of the average of the last week, for example if I am in the 25th week of the year I want the average of the 24th week.

I found a way to calculate the average of the week (http://radacad.com/week-to-date-calculation-in-power-bi-with-dax) :

Week avg bis =
var CurrentDate=LASTDATE('Date bis'[Date])
var DayNumberOfWeek=WEEKDAY(LASTDATE('Date bis'[Date]);3)
return
CALCULATE(DIVIDE([Nb ticket];5);
DATESBETWEEN(
'Date bis'[Date];
CurrentDate;
-1*DayNumberOfWeek;
DAY);
CurrentDate))

So can you help me to modify this measure for do that please ?
Super User

## Re: Average of the last week

Hi @luca_borome,

Assuming the code you show it's working, this minot modification should do the job:

```Week avg bis previous week =
VAR CurrentDate =
LASTDATE ( 'Date bis'[Date] )
VAR DayNumberOfWeek =
WEEKDAY ( LASTDATE ( 'Date bis'[Date] ); 3 )
RETURN
CALCULATE (
DIVIDE ( [Nb ticket]; 5 );
DATESBETWEEN (
'Date bis'[Date];
DATEADD ( CurrentDate; ( -1 * DayNumberOfWeek ) - 7; DAY );
CurrentDate - 7
)
)
```

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 276 members 3,016 guests
Recent signins: