Forum Discussion
Categorize data by specific time periods
Hi there,
I was wondering how I would go about grouping data by specific time intervals during the week.
Priority is to calculate the data based on the following filters for the below times:
Production - Monday at 12:00 am - Friday at 11:00 pm.
Maintenance - Friday at 11:00 pm-Saturday at 4:59 pm
Non - Production - Saturday at 5:00 pm - Sunday at 3:00 pm
Maintenance - Sunday at 3:00 pm - 11:59 pm
Thanks
Hi Anonymous ,
Try to do like this, please refer to my .pbix file.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- amitchandak
Super User
Anonymous , Try like
a new column
Switch(true() ,
Weekday([Datetime],2) in {1,2,3,4} , "Production",
Weekday([Datetime],2) =5 && hour([Datetime]) <=23 , "Production",
(Weekday([Datetime],2) =5 && hour([Datetime]) <=23 ) , "Production",
(Weekday([Datetime],2) =5 && hour([Datetime]) >23) && (Weekday([Datetime],2) =6 && hour([Datetime]) <17) , "Maintenance" ,
(Weekday([Datetime],6) =6 && hour([Datetime]) > 17) && (Weekday([Datetime],2) =6 && hour([Datetime]) <= 15), "Non - Production" ,
"Maintenance"
) - AnonymousNot applicable
Thanks amitchandak , I have tried using that but doesnt seem to recognize the Non -Production time period.
- v-lionel-msft
Community Support
Hi Anonymous ,
Try to do like this, please refer to my .pbix file.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Thanks v-lionel-msft After modifying it a little bit, I got it to work.
- GuillermoSVANew Member
Whay I'm doing wrong?....
I'm trying to use DAX formula in a new column name RealShft but I just can't.
Thanks for helping.
- FaiyazNRegular Visitor
Hi this was really good but when I implemented to my issue it did not work. Can some help me with the below. I have date and time struggling to get the same out put as you got.
Category below
Peak - Monday to Friday between 05:00 and 16:59
Off-Peak - Monday to Friday between 17:00 and 04:59 (including Monday 00:00 to 04:59 and Friday 17:00 to Saturday 00:00)
Weekends - Saturday 00:01 until Sunday 23:59.