Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Gracias por leer.
Tengo dos medidas:
MTD - TOTALMTD(SUM('4011-Visits'[GrossProd]),'Date'[Date])
Hola, @JellyFishBi
Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.
4011-Visitas:
Puede crear medidas como se indica a continuación.
MTD =
var _maxdate = MAX('4011-Visits'[Date])
var _year = YEAR(_maxdate)
var _month = MONTH(_maxdate)
var _day = DAY(_maxdate)
return
CALCULATE(
SUM('4011-Visits'[GrossProd]),
FILTER(
ALLSELECTED('4011-Visits'),
'4011-Visits'[Date]>=DATE(_year,_month,1)&&
'4011-Visits'[Date]<=DATE(_year,_month,_day)
)
)
MTD LY =
var _maxdate = MAX('4011-Visits'[Date])
var _year = YEAR(_maxdate)
var _month = MONTH(_maxdate)
var _day = DAY(_maxdate)
return
CALCULATE(
SUM('4011-Visits'[GrossProd]),
FILTER(
ALLSELECTED('4011-Visits'),
'4011-Visits'[Date]>=DATE(_year-1,_month,1)&&
'4011-Visits'[Date]<=DATE(_year-1,_month,_day)
)
)
Resultado:
Saludos
Allan
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Gracias Allan. Parece que tu solución bien pensada salvó el día.
¿Podría ser abel para hacer lo mismo para la semana hasta la fecha del año pasado (WTD LY)? Actualmente tengo WTD como:
@JellyFishBi que probó la solución @jdbuchanan71 publicado. Nunca publicó comentarios sobre esa solución. Creo que deberías probar y decir si funcionó o no.
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
¿Funcionan estas medidas?
MTD - SUM('4011-Visits'[GrossProd])
MTD LY - CALCULATE([MTD],SAMEPERIODLASTYEAR('Date'[Date]))
Espero que esto ayude.
Tan extraño. He utilizado estas medidas en el pasado, y he funcionado bien en el pasado. Ejecuto al menos 10 modelos dimilar diferentes con la lógica que ha especificado y hace dos días, la lógica había fallado. Me llevó a preguntarme la integridad de la tabla de fechas. Todo parecía caer en su lugar cuando puse el valor de la tabla de fechas finales en Today(). @Ashish_Mathur En sus viajes, ¿ha experimentado alguna vez sus medidas de repente fallando?
Mike
Hola
¿Ha resuelto su pregunta?
Agregue una columna a su tabla 'Fecha' llamada 'Es pasado'
=DATE[Date] <= TODAY()
A continuación, puede cambiar su PY MTD
MTD LY =
CALCULATE( [MTD],
CALCULATETABLE (
SAMEPERIODLASTYEAR ( DATE[Date] ),
DATE[Is Past] = TRUE
)
)
Esto evitará que el calc LY pase la fecha actual, pero en el año anterior.
@jdbuchanan71 gran idea, pero evitaría agregar columna innecesaria, sino más bien obtener la última fecha de transacción y filtrar en eso, lo que sucede si no está mirando el año actual, que viene 2019 vs 2018, esta lógica no funcionará.
Aunque es una solución genial.
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.
Si usted está mirando en 2019 vs 2018 su no va a tener un mes con resultados corrientes parciales, pero completo py reusults aunque. Puede cambiar la comprobación de 'Is Past' para ver say MAX(Sales[Invoice Date]) en su lugar si no desea utilizar TODAY().
Para @parry2k punto, si no desea que la columna 'Es pasado' puede obtener la última fecha de transacción de su tabla de detalles y usarla en un VAR como tal.
MTD LY =
VAR _LastDate = '4011-Visits'[DateField]
CALCULATE( [MTD],
CALCULATETABLE (
SAMEPERIODLASTYEAR ( DATE[Date] ),
DATE[Date] <= _LastDate
)
)
¡Gracias por la ayuda!
@JellyFishBi aplica filtro en la fecha? Total está dando el mes completo de PY.
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.