Forum Discussion
Syndicate_Admin
3 years agoAdministrator
Create button with time filter
I am needing the following: I have a table that has a date and time of a production, the production is divided into three shifts and I want that by means of a button I can see that it occurred in th...
- 3 years ago
I solved it as follows:
I generated a column with the following:
= Table.AddColumn(#"Columna condicional agregada", "TurnoDia", each if DateTime.Time([Hora de finalización]) < #time(6, 10, 0) then "TN" else if DateTime.Time([Hora de finalización]) < #time(14, 34, 0) then "TM" else if DateTime.Time([Hora de finalización]) < #time(23, 0, 0) then "TT" else "TN")Then create a slicer where I can filter by TN, TM or TT
parry2k
3 years agoSuper User
Syndicate_Admin add another column in your table for the shift with something like this:
Shift =
VAR __Time = TIME ( HOUR ( YourTable[YourDateTime Column] ), MINUTE( YourTable[YourDateTime Column] ), 0 )
RETURN
SWITCH (
TRUE (),
__Time >= TIME ( 6, 0, 0 ) && __Time < TIME ( 14, 30, 0 ), "Morning Shift",
__Time >= TIME ( 14, 30, 0 ) && __Time < TIME ( 23, 0, 0 ), "Afternoon Shift",
"Night Shift"
)