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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Split rows based on condition

Hi Community,

 

Hope everyone is doing well.

 

I'm struggling to split rows based on condition. Following is the format of data;

Employee CodeLeave Start DateLeave End DateHoursPeriod End Datestart weekDays diffNet work days
9385/10/202023/10/20207523/10/2020411815
88418/12/20201/01/202137.51/01/2021511411
2055/04/202119/04/202167/05/2021151411
4985/12/202018/12/20207518/12/2020491310
4987/11/202020/11/20207520/11/2020451310

 

I want to put a condition on days diff as follows;

 

Daysdiff > 14 = 3 rows

Daysdiff > 7 = 2 rows

Daydiff < 7 = 1 row

 

with the split, I need two columns such as "Start of week" and "Apportioned hours"

 

Following is what I expect to see as the result;

 

Employee CodeLeave Start DateLeave End DateHoursPeriod End Datestart weekDays diffNet work daysApportioned hoursStart of week
9385/10/202023/10/20207523/10/2020411815255/10/2020
9385/10/202023/10/20207523/10/20204118152512/10/2020
9385/10/202023/10/20207523/10/20204118152519/10/2020

 

Any help with this is highly appreciated.

 

Thank you in advance

 

Best regards,

Ashan

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

4 REPLIES 4
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1625106099983.png

 

Anonymous
Not applicable

Hi @wdx223_Daniel,

 

Can you please let me know the change in code if there is a text column such as employee name?

 

Best Regards,

Ashan.

Anonymous
Not applicable

Hi @wdx223_Daniel,

 

Thank you so much for your solution. Can you please explain what you have done to get results

 

Best regards,

Ashan.

all codes have been shown, i do not know how to explain further.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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