Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hola
Tengo un campo de fecha app_date y quiero crear 2 columnas adicionales
Indicador YTD 1 o 0
Indicador PYTD 1 o 0
¿Alguien puede ayudar con el dax correcto?
Alta @ईएमएल_7
Tal vez puedas probar esto:
Creo una tabla simple, contiene dos fechas.
A continuación, creo dos medidas para satisfacer sus necesidades.
YTD Flag =
IF ( TOTALYTD ( SUM ( 'Table'[app_date] ), 'Table'[app_date] ) > 0, 1, 0 )
PYTD Flag =
IF (
TOTALYTD ( SUM ( 'Table'[app_date] ), SAMEPERIODLASTYEAR ( 'Table'[app_date] ) ) > 0,1,0
)
El resultado es el siguiente:
Saludos
Zhengdong Xu
Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola EML,
Por favor, explíquelo un poco mejor.
¿Qué significa bandera 1 o 0?
No puedo entender lo que quieres hacer
Si una fecha está en el año actual hasta la fecha, marque como 1. Si no está en el año actual hasta la fecha, márquelo como 0.
El mismo principio para el año anterior hasta la fecha
¿Está en el año en curso hasta la fecha?
Puedes comprobar si el año es el mismo. Esta es la medida del dax:
YTD = IF(YEAR('YourTable'[app_date]) = YEAR(TODAY()), 1, 0)
YTDPY = IF(AÑO('TuTabla'[app_date]) = AÑO(HOY()) - 1, 1, 0)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.