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
Anonymous
Not applicable

Recuento de días con número de disminución

Hola a todos

Tengo una tabla que se actualiza diariamente con casos confirmados de covid. Necesito mostrar el número de días que este número está disminuyendo, pero no sé cómo calcular esta información.

He configurado una tabla simplificada para ejemplificar:

Fechanuevos casosDías en disminución
01/08/2020200
02/08/2020151
03/08/2020122
04/08/2020113
05/08/2020300
06/08/2020500
07/08/2020700
08/08/2020451
09/08/2020302
10/08/2020173
11/08/2020164
12/08/2020180

¡Gracias!

1 ACCEPTED SOLUTION

Hola @marimisumoto ,

Pruebe esta medida:

_Count_Decrease = 
VAR _tb = SUMMARIZE(ALL('Table'), 'Table'[Date], 'Table'[new cases], "Decrease",
                        VAR _previousDate = CALCULATE(MAX('Table'[Date]), FILTER(ALL('Table'), 'Table'[Date] < EARLIER('Table'[Date])))
                        RETURN
                            IF('Table'[new cases] < CALCULATE(SUM('Table'[new cases]), FILTER(ALL('Table'), 'Table'[Date] = _previousDate)), 1, 0)
)
VAR _currentDate = SELECTEDVALUE('Table'[Date])
VAR _firstZero = CALCULATE(MAX('Table'[Date]), FILTER(_tb, 'Table'[Date] <= _currentDate && [Decrease] = 0)) 
RETURN 
    SUMX(FILTER(_tb, 'Table'[Date] >= _firstZero && 'Table'[Date] <= _currentDate), [Decrease])

Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@marimisumoto ,

nueva columna como nuevos casos - sumx(filter(table, [fecha] ?earlier([date])-1),[new cases])

Puedes este día vs último día como este con la tabla de citas

Este día: CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]-max('Date'[Date])))
Last Day ? CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]-max('Date'[Date])-1))
Last Day : CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))

Last Day Non Continuous ? CALCULATE([ventas],filter(ALLSELECTED('Date'),'Date'[Date] ?MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Día detrás de Ventas: CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Diff COlumn á datediff(maxx(filter(Table,Table[Date]<earlier(Table[Date]) && Table[Numberf]- earlier(Table[Numberf]) ),Table[Date]) ,Table[Date],Day)

Power BI — Day Intelligence
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5c3243d...

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Apreciamos tus Felicitaciones.

Anonymous
Not applicable

Hola !

Lo siento mucho, pero estoy empezando con power bi.

En mi modelo ya tengo una tabla de calendario, acabo de hacer la relación con la fecha del informe con la fecha del calendario.

Después de eso, ¿debo crear medidas con esta parte?

Este día: CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]-max('Date'[Date])))
Last Day ? CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]-max('Date'[Date])-1))
Last Day : CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))

Last Day Non Continuous ? CALCULATE([ventas],filter(ALLSELECTED('Date'),'Date'[Date] ?MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Día detrás de Ventas: CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Diff COlumn á datediff(maxx(filter(Table,Table[Date]<earlier(Table[Date]) && Table[Numberf]- earlier(Table[Numberf]) ),Table[Date]) ,Table[Date],Day)

¡Gracias!

Hola @marimisumoto ,

Pruebe esta medida:

_Count_Decrease = 
VAR _tb = SUMMARIZE(ALL('Table'), 'Table'[Date], 'Table'[new cases], "Decrease",
                        VAR _previousDate = CALCULATE(MAX('Table'[Date]), FILTER(ALL('Table'), 'Table'[Date] < EARLIER('Table'[Date])))
                        RETURN
                            IF('Table'[new cases] < CALCULATE(SUM('Table'[new cases]), FILTER(ALL('Table'), 'Table'[Date] = _previousDate)), 1, 0)
)
VAR _currentDate = SELECTEDVALUE('Table'[Date])
VAR _firstZero = CALCULATE(MAX('Table'[Date]), FILTER(_tb, 'Table'[Date] <= _currentDate && [Decrease] = 0)) 
RETURN 
    SUMX(FILTER(_tb, 'Table'[Date] >= _firstZero && 'Table'[Date] <= _currentDate), [Decrease])

Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Pragati11
Super User
Super User

HOLA @marimisumoto ,

¿Sobre qué base quieres contar los días de manera decreciente?

No soy capaz de entender el tema claramente. ¿Puede agregar más detalles por favor?

Gracias

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hola !

El recuento debe tener en cuenta el número de días consecutivos en los que el número de casos (en comparación con el día anterior) muestra una disminución.

Ejemplo:
08/26: 40 casos
08/27: 30 casos
08/28: 20 casos

Hoy debo mostrar 3 días.

Si la tabla era como:
08/26: 18 casos
08/27: 30 casos
08/28: 20 casos

Hoy debería mostrar 1 día

Si el número en 08/28 fue un aumento, debería mostrar 0 ...

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.

Top Kudoed Authors