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
Almudena1997
New Member

Restar celdas

Tengo una columna con las horas acumuladas por meses. Necesito calcular las horas totales de cada mes, es decir, reiniciar las horas acumuladas hasta ese mes menos las acumuladas hasta el mes anterior. Por ejemplo: Si hasta enero de 2022 son 3806 horas y en febrero son 3846, pues necesito saber como calcular (Horas febrero - Horas enero) = (3846 - 3806 = 40). Gracias. 

3 REPLIES 3
Almudena1997
New Member

Tengo una columna con las horas acumuladas por meses. Necesito calcular las horas totales de cada mes, es decir, reiniciar las horas acumuladas hasta ese mes menos las acumuladas hasta el mes anterior. Todo esto mientras que la columna TIPO sea igual a DIESEL. Por ejemplo: Si hasta enero de 2022 son 3806 horas y en febrero son 3846, pues necesito saber como calcular (Horas febrero - Horas enero) = (3846 - 3806 = 40). gracias

amitchandak
Super User
Super User

@Almudena1997 ,

Make sure you have a column like YYYYMM of Month end date call it date (as of now).

 

Then have a new column

 

New column =

var _max = maxx(filter(Table, Table[Date] < earlier(Table[Date]) ),  Table[Date])

return

maxx(filter(Table, Table[Date] =_max ),  Table[Value])

@amitchandak ¡Hola! Muchas gracias por tu respuesta pero con este código me aparece solo la primera linea con un 0. New column = var _max = maxx(filter('HORÓMETRO', 'HORÓMETRO'[Fecha] < anterior('HORÓMETRO'[Fecha])) ,'HORÓMETRO'[Fecha]) return MAXX(filtro('HORÓMETRO', 'HORÓMETRO'[Horas] =_max ), 'HORÓMETRO'[Horas])

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.