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
gauri
Helper III
Helper III

Problema con las fechas acumuladas en power BI

Hola a todos

Me enfrento a un problema en cómo programar esto en Power Bi. Comparte una captura de pantalla para ello.

Si marca startDTM, ENDDTM y ENDREASON

así que donde mi COLUMN ENDREASON dice Out para esa entrada de tiempo en particular es correcta, pero donde dice cómo se perdieron las entradas de tiempo, es decir, la hora de inicio y la hora de finalización son incorrectas. Si consideramos la primera fila tenemos un STARTDTM de 6.30 y ENDDTM de 8.00, por lo que la siguiente entrada debe tomar STRTDTM de 8.00 que es, este caso está tomando como 23.15.

Así que básicamente, si mi ENDREASON - missedout entonces el STARTDTM debe tomar la hora de finalización de la entrada privious y ENDDTM para la entrada perdida debe ser 23.15 en este caso.

¿Puede alguien ayudarme con Dax o con lógica que se puede implementar en Power BI.

Gracias

Gauri

5 REPLIES 5
dax
Community Support
Community Support

Hola @gauri ,

Podría intentar crear una columna de índice como la siguiente

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA30TcyVzAwsAIjJR0kQTMrYwwxC7g6/9AQIGmoFKtD0CAjYytDUzyCvp7Bwa4uEAONiDHQAouYoQGa04yVYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [APPLYDATE = _t, STARTDTM = _t, ENDDTM = _t, ENDREASON = _t, ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"APPLYDATE", type datetime}, {"STARTDTM", type datetime}, {"ENDDTM", type datetime}, {"ENDREASON", type text}, {"ID", Int64.Type}})
in
    #"Changed Type"

A continuación, intente a continuación la medida para ver si funciona o no

Measure 4 = var pre=CALCULATE(MIN('Table (2)'[ENDDTM]), FILTER(ALL('Table (2)'), 'Table (2)'[ID]=MIN('Table (2)'[ID])-1)) return  IF(MIN('Table (2)'[ENDREASON])="OUT", (DATEDIFF(MIN('Table (2)'[APPLYDATE]), MIN('Table (2)'[STARTDTM]),MINUTE)-DATEDIFF(MIN('Table (2)'[STARTDTM]),MIN('Table (2)'[ENDDTM]),MINUTE))/60,(DATEDIFF(MIN('Table (2)'[APPLYDATE]), pre,MINUTE)-DATEDIFF(pre,MIN('Table (2)'[ENDDTM]),MINUTE))/60 )

685.PNG

Saludos
Zoe Zhi

Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Greg_Deckler
Super User
Super User

Vea mi artículo sobre el tiempo medio entre el error (MTBF) que utiliza EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...

Si tiene algo que define "anterior", las técnicas de ese artículo funcionarán.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

Vea mi artículo sobre el tiempo medio entre el error (MTBF) que utiliza EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...

Necesitará algo que defina "anterior" para DAX. Si tienes eso, entonces las técnicas de ese artículo funcionarán.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
sanimesa
Post Prodigy
Post Prodigy

@gauri ¿Puede scompartir la fórmula que está utilizando? No está claro con qué datos está empezando.

@sanimesa No he utilizado ninguna medida para los campos datetime, es su manera de corregir el campo existente

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.