Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jcabeza
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
affan
Solution Sage
Solution Sage

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

jcabeza
Frequent Visitor

It's not the solution, but thanks

Hi @jcabeza

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.