Forum Discussion
ReyDeSirenas
3 years agoRegular Visitor
Create shift from time
Hi, I´ve been trying to figure this out. So basically I want to create a new table named "Shift" with only two values: Shift 1 and Shift 2. Shift 1 goes from 07:30 to 19:30 and Shift 2 goes from...
- 3 years ago
Hi ReyDeSirenas in DAX this is simple to achieve as dates and times work similar to numbers, and you can perform greater than / less than comparisons easily.
This expression as a calculated column (ie, not measure) in the same table as the time element should work.
Shift = "Shift " & If('Days and hours'[Time] >= time(7,30,0) && 'Days and hours'[Time] < time(19,30,0), 1,2)
Result:
HTH
Pi
PiEye
3 years agoResolver II
Hi ReyDeSirenas in DAX this is simple to achieve as dates and times work similar to numbers, and you can perform greater than / less than comparisons easily.
This expression as a calculated column (ie, not measure) in the same table as the time element should work.
Shift = "Shift " & If('Days and hours'[Time] >= time(7,30,0) && 'Days and hours'[Time] < time(19,30,0), 1,2)
Result:
HTH
Pi
ReyDeSirenas
3 years agoRegular Visitor
Thanks a lot! That worked and you help me a lot to understand how it works!