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
j_martinho
Helper I
Helper I

Sumar los valores totales de columna de los últimos 14 días

¡Hola!

Estoy intentando crear una nueva columna (DAX o PowerQuery) para que agregue el valor de la columna Cases de los últimos 14 días.

La suma debe tener en cuenta el CityCode. Por lo tanto, agregando los últimos 14 días para cada CityCode.

¿Me puedes ayudar?

Ejemplo de datos:

FechaCasosCityCodeTotal de casos Duran 14 días
10/08/202030125329737
09/08/202012335326725
08/08/202019215325492
07/08/202019035323571
06/08/202020345321668
05/08/202020425319634
04/08/202018805317592
03/08/202020165315712
02/08/202021065313696
01/08/202016305311590
31/07/20201850539960
30/07/20202100538110
29/07/20201616536010
28/07/20202246534394
27/07/20202148532148
10/08/202040121144737
09/08/202022331140725
08/08/202029211138492
07/08/202029031135571
06/08/202030341132668
05/08/202030421129634
04/08/202028801126592
03/08/202030161123712
02/08/202031061120696
01/08/202026301117590
31/07/202028501114960
30/07/202031001112110
29/07/20202616119010
28/07/20203246116394
27/07/20203148113148
1 ACCEPTED SOLUTION

@amitchandak Hice dos ajustes y lo resolví. ¡Gracias!

Casos Ativos = 

sumx(
    filter(NOVO_PROTO,
            NOVO_PROTO[city_ibge_code] = earlier( NOVO_PROTO[city_ibge_code] )
             && NOVO_PROTO[Data] <= earlier( NOVO_PROTO[Data] )
             && NOVO_PROTO[Data] >= earlier( NOVO_PROTO[Data] )-13),

    NOVO_PROTO[Novos Confirmados])

View solution in original post

4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hola @j_martinho

¿Desea obtener los resultados de suma de [Total Cases Last 14 days] por [Citycode]? Puede probar a continuación la columna calculada:

Column = CALCULATE(SUM('Table (2)'[Total Cases Last 14 days]),FILTER(ALL('Table (2)'),[CityCode]=EARLIER('Table (2)'[CityCode])))

Si no ayuda. por favor amablemente elaborar más.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@j_martinho , Pruebe una nueva columna

sumx(filter(Table, [CityCode] á earlier( [CityCode] ) && [CityCode] <- earlier( [Date] ) && [CityCode] >- earlier( [Date] )-14),[Total Cases])

@amitchandak Hice dos ajustes y lo resolví. ¡Gracias!

Casos Ativos = 

sumx(
    filter(NOVO_PROTO,
            NOVO_PROTO[city_ibge_code] = earlier( NOVO_PROTO[city_ibge_code] )
             && NOVO_PROTO[Data] <= earlier( NOVO_PROTO[Data] )
             && NOVO_PROTO[Data] >= earlier( NOVO_PROTO[Data] )-13),

    NOVO_PROTO[Novos Confirmados])

@amitchandak Gracias. Pero la columna se quedó en blanco.

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.