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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Leoca90
New Member

Promedio ocupación por fechas y centros

Hola a tod@s,

 

Necesito calcular el promedio de ocupación de una serie de centros teniendo por fecha filtrada. Es decir, necesito saber la ocupación media por centro contando el número de días que he filtrado.

centro_ekonfechaocupacion_real
Centro 101/01/202332
Centro 101/01/202315
Centro 101/01/202310
Centro 101/02/202332
Centro 101/02/202314
Centro 201/01/202314
Centro 201/01/2023dieciséis
Centro 201/02/202310
Centro 201/02/20239
Centro 201/03/202310
Centro 201/03/20238

 

No sé si con la función valor promedio podría hacerse o hay otra forma con divide sumx, nº de días inicio y fin 

 

Agradecería mucha la ayuda. un saludo

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @Leoca90 ,

Please try this measure:

average occupancy = 
DIVIDE (
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[centro_ekon],
            'Table'[fecha],
            "average",
                CALCULATE (
                    AVERAGE ( 'Table'[ocupacion_real] ),
                    'Table'[fecha] = EARLIER ( 'Table'[fecha] )
                )
        ),
        [average]
    ),
    COUNTROWS ( 'Calendar' )
)

Output:

vcgaomsft_2-1701428770872.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Syndicate_Admin
Administrator
Administrator

what would be the expected result based on your sample data?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors