Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Estoy tratando de calcular las horas facturables MTD y me preguntaba si la siguiente medida para calcular las horas facturables anteriores del mes pasado podría formatearse para funcionar
Horas facturables del último mes =
VAR PreviousMonths=1
VAR SelYear = Si(MES(HOY())-MesesAnteriores<=0, AÑO(HOY())-1, AÑO(HOY()))
VAR SelMonth= IF(MONTH(TODAY())-PreviousMonths<=0, MONTH(TODAY())-PreviousMonths +12, MONTH(TODAY())-PreviousMonths)
VAR SelDay= DÍA(HOY())
VAR SelMonthDay = FORMAT(DATE(SelYear,SelMonth,SelDay), "MMMM AAAA")
Devolución
CALCULATE([Chargeable Hours], FILTER('Work Date', 'Work Date'[Calendar Month Of Year]=SelMonthDay))
MTD= calculate(Sum('order'[Qty]),DATESMTD('Date'[Date]))
LMTD =CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)))
Puede completar si el mes completo está dentro del alcance
LMTD QTY forzado =
var _max = fecha(año(hoy()),mes(hoy())-1,día(hoy()))
devolución
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
O
CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
LMTD QTY forzado =
Var _Maxdate = MAX('Tabla de fechas'[Fecha])
var _max = fecha(año(_Maxdate),mes(_Maxdate)-1,día(_Maxdate))
devolución
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
O
CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)