Forum Discussion
Changing Column to Two Groups
- 4 years ago
Hi villasenorbritt ,
If this hour in fact table, then don't make any change in this table. Just create a Dimension table with shift timing and make a realtionship with Hour of dim table with your fact table with Hour columns. Advantage of this is, you have more control on slicing and filtering of the data in your report.
To make a dim table, I would suggest that at first prepare it in excel as below:
Hour Shift ShiftTime 0 PM 5PM-5AM 1 PM 5PM-5AM 2 PM 5PM-5AM 3 PM 5PM-5AM 4 PM 5PM-5AM 5 AM 5AM-5PM 6 AM 5AM-5PM 7 AM 5AM-5PM 8 AM 5AM-5PM 9 AM 5AM-5PM 10 AM 5AM-5PM 11 AM 5AM-5PM 12 AM 5AM-5PM 13 AM 5AM-5PM 14 AM 5AM-5PM 15 AM 5AM-5PM 16 AM 5AM-5PM 17 AM 5AM-5PM 18 PM 5PM-5AM 19 PM 5PM-5AM 20 PM 5PM-5AM 21 PM 5PM-5AM 22 PM 5PM-5AM 23 PM 5PM-5AM 24 PM 5PM-5AM Why, because this is a kind of fixed table, and should not change so often.
Then copy it. Ctrl+C
In power BI use enter data to paste this table:
Paste as below and create a new dim Shift table:
Now just relate hour of this table with fact table's hour column with 1 to many relationship.
Use dim table columns as slicers in your visuals.
Hope it helps.
So how would I do the conditional columns if the AM shift runs from 5 AM to 5PM and the night shift runs from 5PM to 5 AM? I am not able to do the less than since it will add parts that belong to the other shift since PM works through the night and morning. Again, very thankful for your help.
Hi villasenorbritt ,
You can try something like this
For AM
For PM
Result
If you want an overlap in shift end time, replace [Hour] < with [Hour]<=
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊
- villasenorbritt4 years agoResolver I
I'm getting "Table" when I do this and it doesn't have all the numbers showing like yours does. Wha could I be doing wrong?