cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Create a column that contains the previous average of days

I have 2 tables.
The First with the calendar of the year (Calendario)
The Second with daily assistance. (Asistencia)
As shown below

                 Calendario.jpg           Asistencia.png

 

 

I need to add a column to the attendance table that shows the previous average of the last 3 weeks (excluding the day) according to the day as for example

 

Resultado Esperado.jpg

 

I did this Dax formula but only the attendance of the day and I do not know how to add the filter per day

 

Prom Anterior Diario = CALCULATE(AVERAGEX(Asistencia;Asistencia[Asistencia]);DATESBETWEEN(Calendario[Fecha];DATEADD(Asistencia[Fecha];-21;DAY);DATEADD(ResumenDiario[Fecha];-1;DAY))

3 REPLIES 3
Solution Sage
Solution Sage

Re: Create a column that contains the previous average of days

Hi @jcabeza,

 

Please use the below DAX

Prom sAnterior Diario = CALCULATE(AVERAGEX(Asistencia,Asistencia[Asistencia]),DATESBETWEEN(Calendario[Fecha],DATEADD(Asistencia[Fecha],-21,DAY),DATEADD(Asistencia[Fecha],-1,DAY)))

I have got the below result from this DAX

Asistencia.png

 

 

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

Highlighted
Frequent Visitor

Re: Create a column that contains the previous average of days

It's not the solution, but thanks

Highlighted
Solution Sage
Solution Sage

Re: Create a column that contains the previous average of days

Hi @jcabeza

 

Can you please share what issue you got with this measure? What result does this show in your data?

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Kudoed Authors