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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
joep78
Helper III
Helper III

Calcular la duración del contrato en función de una segmentación de fechas

Hola a todos

Estoy luchando con una medida para obtener una visión general por año de la SUMA de la duración del contrato. este primer año debe basarse en una segmentación de fechas.

el contenido es el siguiente (ejemplo simple):

código del contratofecha de finalización del contrato
131/12/2022
231/12/2023
331/12/2022
431/12/2025
531/12/2021

cuando establezca la segmentación de fecha en 2020, el resultado debe ser:

202020212022202320242025
321000
432100
321000
654321
210000
Duración del contrato SUM18138421

No puedo averiguar qué tipo de medida debo usar para obtener este resultado. ¡Esperemos que alguien pueda ayudarme!

3 REPLIES 3
amitchandak
Super User
Super User

@joep78 , Pruebe una nueva medida como

Supongamos que tiene calendario de fechas

Measure = calculate(datediff(min(Table[contract end date]), startofyear(Date[Date]),Month),all(date))
or
Measure = calculate(datediff(min(Table[contract end date]), endofyear(Date[Date]),Month),all(date))

Puede reemplazar all(date) con allselected(date) o eliminar según la necesidad

Para obtener lo mejor de la función de inteligencia de tiempo. Asegúrese de que tiene un calendario de fechas y se ha marcado como la fecha en la vista de modelo. Además, únase a él con la columna de fecha de su 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...


Aprecia tus Felicitaciones.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@joep78 ves adjunto, espero que esto es lo que estás buscando. un montón de partes móviles en ella.

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Gracias por esta solución en el ejemplo, es exactamente lo que estaba buscando!

¡Felicidades por ti!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors