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
bo_afk
Post Patron
Post Patron

Crear una bandera para los números de la semana de este año

Tengo datos de 2019 y 2020 hasta la fecha con las siguientes columnas.

añoWeekNumberMétricas

Me gustaría crear otra columna con una bandera para los números de semana de 2020, por ejemplo, para 2020 tengo datos de las semanas 1 a la semana 17, así que ponga el valor '1' para cada vez que el número de semana esté entre estos para ambos años y '0' de lo contrario.

Para 2020, los valores de marca deben ser '1'.

Salida deseada

añoWeekNumberMétricasBandera
201916#1
201925#0

He creado la siguiente fórmula, pero no parece funcionar.

Columna de la bandera: IF(WeekNumber<-CALCULATE(MAX([WeekNumber]),[Year]-2020),1,0))

¿Puede alguien decirme qué tiene de malo esta fórmula y cómo la arreglaría?

¡Gracias!

Afk

1 ACCEPTED SOLUTION

Hola @bo_afk ,

Actualice la fórmula de su columna calculada "Flag Column"con la siguiente:

Columna de la bandera: IF(WeekNumber<-CALCULATE(MAX([WeekNumber]),FILTER('TABLE_NAME',[Año]-2020)),1,0)

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@bo_afk no está claro lo que está buscando, en su muestra tiene el año 2019 y uno tiene la bandera 1 y otro 0, proporcione un poco más de contexto y detalles.

Lea este post para obtener su respuesta rápidamente.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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.

Hola @parry2k , esto fue explicado en el post sobre la tabla de "salida deseada".

Me gustaría crear otra columna con una bandera para los números de semana de 2020, por ejemplo, para 2020 tengo datos de las semanas 1 a la semana 17, así que ponga el valor '1' para cada vez que el número de semana esté entre estos para ambos años y '0' de lo contrario.

Si esto no es visible en el post hágamelo saber y voy a tratar de solucionarlo.

@bo_afk no está claro en absoluto, tiene 2019 en los datos de ejemplo y la marca se establece en 1. Tal vez no lo estoy leyendo correctamente.



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.

@parry2k Me gustaría marcar los números de la semana identificando las semanas disponibles para 2020. Desde 2020 estamos sólo en la semana 17, me gustaría marcar todas las filas donde el número de semana está entre 1 y 17 para 2019 y 2020.

"poner el valor '1' para cada número de semana entre estos para ambos años y '0' de lo contrario."

Números de la semana para 2020 - 1 - 17

Bandera 1 cuando el número de semana está entre 1 y 17

Bandera 0 cuando el número de semana no está entre 1 y 17

Hola @bo_afk ,

Actualice la fórmula de su columna calculada "Flag Column"con la siguiente:

Columna de la bandera: IF(WeekNumber<-CALCULATE(MAX([WeekNumber]),FILTER('TABLE_NAME',[Año]-2020)),1,0)

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hola @yingyinr, gracias por sus comentarios, esto ha funcionado perfectamente!

Sólo para que pueda entender, ¿puede explicar por qué la fórmula inicial no funcionó?

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.