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
Syndicate_Admin
Administrator
Administrator

Número de semana que no coincide con la fecha

Hola

Tengo un problema con los números de la semana. He creado una columna llamada YearWeek usando lo siguiente:

YearWeek ? IF(WEEKNUM([Fecha].[ Fecha])<10,FORMAT([Fecha],"YY0WW"),FORMAT([Fecha],"YYWW"))
Puse la fecha y la semana del año en una mesa y obtuve lo siguiente:

yearweek.png

Mis problemas es que las semanas no coinciden con las fechas correctas. Por ejemplo, en esta tabla muestra que la semana 3 está entre el 10-16 de enero, pero en realidad está entre el 17 y el 24 de enero. Quiero que la semana 1 comience con el 3 de enero.

¿Puede alguien ayudarme, por favor?

Agradecido por el apoyo,

1 ACCEPTED SOLUTION

@AnnaML

Prueba esta fórmula:

YearWeek ? RIGHT(IF(WEEKNUM('Calendar'[Date], 21)-53 && MONTH('Calendar'[Date])-1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])),2) & WEEKNUM('Calendar'[Date], 21)

View solution in original post

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Hola, ¿qué tal si solo quiero el número de semana, WW?

Gracias.

Syndicate_Admin
Administrator
Administrator

@AnnaML

Si desea utilizar una semana Iso YEAR la fórmula debe ser así:

YearWeek = IF(WEEKNUM('Calendar'[Date], 21)=53 && MONTH('Calendar'[Date])=1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])) & "-" & WEEKNUM('Calendar'[Date], 21)

Es necesario poner otro parámetro en la función weeknum.... el parámetro con el valor 21.

Véase también el siguiente enlace:

https://community.powerbi.com/t5/Desktop/Looking-for-real-year-week/m-p/1591530#M646306

Hola

Gracias por tu respuesta. Parece funcionar. Aunque es posible mostrar YYWW en lugar de YYYY-WW?

Atentamente

@AnnaML

Prueba esta fórmula:

YearWeek ? RIGHT(IF(WEEKNUM('Calendar'[Date], 21)-53 && MONTH('Calendar'[Date])-1, YEAR('Calendar'[Date]) -1, YEAR('Calendar'[Date])),2) & WEEKNUM('Calendar'[Date], 21)

Gracias por el apoyo, realmente ayudó!

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