Forum Discussion
Syndicate_Admin
2 years agoAdministrator
Splitting with text
Good day I would like your support in solving the following question within power bi. I need to divide the number of hours worked by 8 but I have workers who have a 12-hour shift and these need t...
rsbin
2 years agoCommunity Champion
Assuming you have "Position" as as a field in your table, you can create a calculated column using the Switch function. So something like this:
NewColumn = SWITCH(
TRUE()
[Position] = "A", Divide( [Hours], 12, 0 ),
[Position] = "B", Divide( [Hours], 12, 0 ),
[Position] = "C", Divide( [Hours], 12, 0 ),
[Position] = "D", Divide( [Hours], 12, 0 ),
Divide( [Hours],8, 0 )
If you are comfortable, you can combine the first 4 conditions into 1 using the OR Statement.
Hope this gets you what you are after.
Regards,