Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hola a todos,
Tengo una columna que contiene Tiempos de transacción.
¿Cómo puedo crear una columna calculada que diferencie el tiempo en diferentes categorías como se muestra a continuación?
Si el tiempo está entre 23:45:01.0000000 y 06:45:00.0000000, entonces es noche.
Si la hora está entre las 06:45:01.0000000 y las 15:15:00.0000000, entonces es por la mañana.
Si la hora está entre las 15:15:01.0000000 y las 23:45:00.0000000, entonces es mediodía.
¡Gracias!
Puede crear una columna calculada que utilice la instrucción switch para especificar el período del día en función de la condición que especifique. Vea el código a continuación.
TimeCategory =
VAR CurrentTime = [TransactionTime]
RETURN
SWITCH(
TRUE(),
CurrentTime >= TIME(23, 45, 1) || CurrentTime < TIME(6, 45, 0), "Night",
CurrentTime >= TIME(6, 45, 1) && CurrentTime < TIME(15, 15, 0), "Morning",
CurrentTime >= TIME(15, 15, 1) && CurrentTime < TIME(23, 45, 0), "Noon",
"Unknown"
)
¡Espero que esto ayude!
Hola @mrbuttons07 - cree una columna calculada a continuación, reemplace el nombre de su tabla y la columna de tiempo
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.