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.
Tengo una medida que calcula el número PrevQ
PREVQ Ventas = CALCULAR(
SUMA(Ventas[SalesAmount]),
PREVIOUSQUARTER('DateTime'[DateKey])
)
Esto funciona cuando uso la medida en una tabla con dimensión temporal. Sin embargo, si tuviera que usar esta medida en una tarjeta, el valor estará vacío a menos que seleccione un trimestre específico. Creo que esto se debe a la falta de contexto de fecha y hora para que la función Trimestre anterior funcione.
¿Cómo consigo que utilice el período completo para el contexto si no se selecciona ningún trimestre?
Solved! Go to Solution.
@gancw1 , si no selecciona una fecha en la página, el trimestre anterior tomará el calendario de la primera fecha.
Si tu calendario está limitado hasta el mes actual
puede utilizar
Últimas ventas QTD = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Ventas del último trimestre = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
o hacerlo en base a hoy
QTD hoy=
var _month = mod(mes(hoy()),3)
var _min = fecha(año(hoy()),mes(hoy()) -1* si(_month=0,3,_month) ,1)
var _day = hoy()
devolución
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )
LQTD hoy=
var _month = mod(mes(hoy()),3)
var _min = eomonth(date(year(today()),month(Today()) -1* if(_month=0,3,_month) ,1),-4)+1
var _day = fecha(año(hoy()), mes(hoy()) -3 , día(hoy()))
devolución
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )
Inteligencia de tiempo, DATESMTD, DATESQTD, DATESYTD, semana a semana, semana hasta la fecha, período personalizado en el período,
Período personalizado hasta la fecha: https://youtu.be/aU2aKbnHuWs&t=145s
@gancw1 , si no selecciona una fecha en la página, el trimestre anterior tomará el calendario de la primera fecha.
Si tu calendario está limitado hasta el mes actual
puede utilizar
Últimas ventas QTD = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Ventas del último trimestre = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
o hacerlo en base a hoy
QTD hoy=
var _month = mod(mes(hoy()),3)
var _min = fecha(año(hoy()),mes(hoy()) -1* si(_month=0,3,_month) ,1)
var _day = hoy()
devolución
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )
LQTD hoy=
var _month = mod(mes(hoy()),3)
var _min = eomonth(date(year(today()),month(Today()) -1* if(_month=0,3,_month) ,1),-4)+1
var _day = fecha(año(hoy()), mes(hoy()) -3 , día(hoy()))
devolución
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )
Inteligencia de tiempo, DATESMTD, DATESQTD, DATESYTD, semana a semana, semana hasta la fecha, período personalizado en el período,
Período personalizado hasta la fecha: https://youtu.be/aU2aKbnHuWs&t=145s
Gracias @amitchandak.
¿Cómo calculo el valor total del último trimestre en lugar del último trimestre hasta la fecha?
Hola
Comparta algunos datos y muestre el resultado esperado.
Digamos que tengo estos datos que se actualizan diariamente
Mes | Número |
20/4/2022 | 20 |
31/3/2022 | 10 |
28/2/2022 | 10 |
31/1/2022 | 10 |
31/12/2021 | 20 |
30/11/2021 | 20 |
El trimestre actual es el 2T (abril). Me gustaría mostrar el número del último trimestre que es para Jan-Mar = 10 + 10 + 10 = 30
Gracias. ¿Puede compartir la lógica de la fórmula?
Measure =
if(ISBLANK([Selected Quarter]),
CALCULATE([Total],
DATESBETWEEN('Calendar'[Date],
edate(date([Selected year],int(divide(month(today()),3))*3,1),-2),
eomonth(date([Selected year],int(divide(month(today()),3))*3,1),0))
),
[Total])
De nada. Si mi respuesta anterior ayudó, por favor márquela como Respuesta.
Por lo tanto, la función DATESBETWEEN() devolverá una tabla de fechas entre el 1 de enero de 2022 y el 31 de marzo de 2022.
Espero que esto ayude.
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 |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |