Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

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 to be divided by 12 which differentiates them from the others are 4 different positions within the company.

How might this division be applied?

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Perfect friend thank you very much solved

@Syndicate_Admin ,

Please "Accept as Solution" to close this thread and give Kudos if you feel like doing so.

Kind Regards,

Syndicate_Admin
Administrator
Administrator

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))

@Syndicate_Admin ,

Think you are missing a comma "," after TRUE()

Please try this:  Wages = SWITCH(
                                              TRUE(),

Syndicate_Admin
Administrator
Administrator

IMG-20231024-WA0002.jpg

I've tried to enter as you indicate, it would be like that, right?

IMG-20231024-WA0001.jpg

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.

@Syndicate_Admin ,

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

rsbin
Super User
Super User

@Syndicate_Admin ,

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,

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors