Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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 to be divided by 12 which differentiates them from the others are 4 different positions within the company.
How might this division be applied?
Perfect friend thank you very much solved
Please "Accept as Solution" to close this thread and give Kudos if you feel like doing so.
Kind Regards,
I understand in my case the place where the filtering would be is in the work column I have placed it and it throws an error in syntaxy
Wages = SWITCH(
TRUE()
[Labor] = "FERTIGATION CONTROL-FILTERED OPERATOR", DIVIDE( Append1[Effective Hours], 12, 0),
[Labor] = "FERTILIZATION", DIVIDE( Append1[Effective Hours], 12, 0),
[Labor] = "IRRIGATION SYSTEM MAINTENANCE", DIVIDE( Append1[Effective Hours], 12, 0),
[Labor] = "OPERATOR INFRA. OF IRRIGATION AND HYDRA.", DIVIDE( Append 1[Effective Hours], 12, 0),
DIVIDE(Append1[Effective Hours],8,0))
Think you are missing a comma "," after TRUE()
Please try this: Wages = SWITCH(
TRUE(),
I've tried to enter as you indicate, it would be like that, right?
In the red column is the total hours and the green column would be where the conditional division would have to go with those 4 positions.
You have misunderstood the syntax.
[Position] is the name of the field. So in your case I assume this to be [Trajadore].
I have used the letters A, B, C, D as placeholders for the actual text of the Positions that need to be divided by 12.
So instead of "A", you enter "....Operador Filtrado ".
Instead of "B", you enter "Fertilizacion". Enter the text exactly how it appears in your [Trabajado] column.
Use the exact text of the position
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,
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.