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.
¡Hola Comunidad! Tengo un problema a la hora de ver el mes anterior, la idea de este código es que si estoy en enero que muestre la temporada de diciembre del año pasado. Intenté ocupando previous month o dateadd, sin embargo, no logré armar la formula. Actualmente este es la que estoy ocupando, pero tampoco funciona. ¡Agradecería su ayuda, Saludos!
IF (
YEAR( Calendario[Date] ) = year(date(2023,01,15))
&& month (Calendario[Date] ) = month(date(2023,01,15))-1,
1, if(
YEAR( Calendario[Date] ) = year(date(2023,01,15))-1
&& month (Calendario[Date] ) = month(date(2023,01,15))-(month(date(2023,01,15))-1),1,0)
)
(la fecha debería ser today(), pero estaba probando suponiendo que el mes fuera enero)
Solved! Go to Solution.
HI @Aileen167,
I think it should relate to you extract the month number and minus it with 1. These conditions are equal to filter records who equal to current year and zero-month number. (this is an invalid date value)
I'd like to suggest you directly move month transform calculations into the date function:
formula =
VAR _cDate =
DATE ( 2023, 01, 15 )
VAR _pDate =
DATE ( YEAR ( _cDate ), MONTH ( _cDate ) - 1, DAY ( _cDate ) )
RETURN
IF (
YEAR ( Calendario[Date] ) = YEAR ( _cDate )
&& MONTH ( Calendario[Date] ) = 1,
_pDate,
_cDate
)
Regards,
Xiaoxin Sheng
HI @Aileen167,
I think it should relate to you extract the month number and minus it with 1. These conditions are equal to filter records who equal to current year and zero-month number. (this is an invalid date value)
I'd like to suggest you directly move month transform calculations into the date function:
formula =
VAR _cDate =
DATE ( 2023, 01, 15 )
VAR _pDate =
DATE ( YEAR ( _cDate ), MONTH ( _cDate ) - 1, DAY ( _cDate ) )
RETURN
IF (
YEAR ( Calendario[Date] ) = YEAR ( _cDate )
&& MONTH ( Calendario[Date] ) = 1,
_pDate,
_cDate
)
Regards,
Xiaoxin Sheng
Muchas gracias! ahora que esta en date() retorna un 12
flag =
Var c_fecha= date(year (today()), Month (today())-1, Day(today()))
Return
IF (
YEAR( Calendario[Date] ) = year(today())
&& month (Calendario[Date] ) =Month( c_fecha),
1, 0
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
138 | |
107 | |
104 | |
82 | |
63 |