Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
hola
Necesito cambiar UTC a NZT en Dax. No puedo hacerlo en PowerQuery porque estoy usando DirectQuery en lugar de importar y no funcionará a menos que importe mis tablas, lo que no quiero hacer.
Esencialmente necesito convertir marcas de tiempo de GMT a UTC y encontré esto. ¿Puede alguien ayudarme a convertirlo a DAX?
(datetimecolumn as datetime) =>
let
date = DateTime.Date(datetimecolumn),
time = DateTime.Time(datetimecolumn),
firstSundayOfApril = Date.StartOfWeek(#date(Date.Year(date), 4, 7), Day.Sunday),
LastSundayOfSeptember = Date.StartOfWeek(#date(Date.Year(date), 9, 30), Day.Sunday),
isSummerTime = (date = LastSundayOfSeptember and time >= #time(1,0,0))
or
(date > LastSundayOfSeptember and date < firstSundayOfApril)
or
(date = firstSundayOfApril and time >= #time(1,0,0)),
timeZone = (12 + Number.From(isSummerTime))*1,
NZT =
DateTime.From(date)
+ #duration(0,Time.Hour(time),Time.Minute(time),Time.Second(time))
+ #duration(0, timeZone, 0, 0)
in
NZT
¡Gracias!
¿Está agregando una columna calculada de DAX como esta?
NZT_dt =
VAR CurY =
YEAR ( yourTable[OriginDT] )
VAR StartST =
DATE ( CurY, 4, 7 ) - WEEKDAY ( DATE ( CurY, 4, 7 ), 1 ) + 1
VAR EndST =
DATE ( CurY, 9, 30 ) - WEEKDAY ( DATE ( CurY, 9, 30 ), 1 ) + 1
RETURN
IF (
yourTable[OriginDT] > StartST
&& yourTable[OriginDT] < EndST,
yourTable[OriginDT] + ( 13 / 24 ),
yourTable[OriginDT] + ( 12 / 24 )
)
?