Forum Discussion

rahul_ferns's avatar
rahul_ferns
Helper II
2 years ago
Solved

Split Column Based On Criteria

Hello Experts

I need some advise and help with something I need

Got a column "OT Hrs" which I want to conditionally split into two columns based on the below criteria

 

If the value of the column is between 0 to 0.4, then that value goes into a column called Included OT

If the value of the column is >0.4, then 0 to 0.4 value goes to column called Included OT and the balance goes into another column called Extra OT

 

See below some data and results 

 

OT HrsIncluded OTExtra OT
000
0.40.40
0.650.40.25
1.650.41.25
0.90.40.5
000
0.320.320
2.40.42
1.730.41.33
2.150.41.75
30.42.6
2.420.42.02
2.030.41.63
000
2.90.42.5
000

 

Regards

Rah

  • Power Query

     

     

    Included OT
    if [OT Hrs] >.4 then .4 else [OT Hrs]
    Excluded OT
    if [OT Hrs] = [Included OT] then 0 else [OT Hrs]-[Included OT]

     

     

2 Replies

  • mussaenda's avatar
    mussaenda
    Community Champion

    Power Query

     

     

    Included OT
    if [OT Hrs] >.4 then .4 else [OT Hrs]
    Excluded OT
    if [OT Hrs] = [Included OT] then 0 else [OT Hrs]-[Included OT]