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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Emmeli
Frequent Visitor

Split h worked from one specific Unit to several units

Hi

 

I would like to Split "hours worked" marked with registered on Unit 1 in to several new rows.

 

This is the data I have

 

Owner Hours workedDate Object_1 Object_2
Person 1 82024-01-01 Unit 1 Development work
Person 2 82024-01-01 Unit 1 Administration
Person 3 82024-01-01 Unit 1 Development work
Person 4 82024-01-01 Unit 2 Administration
Person 5 82024-01-01 Unit 3 Administration
Person 6 1,52024-01-01 Unit 4 Traveltime
Person 6 42024-01-02 Unit 1 Development work
Person 1 32024-01-02 Unit 1 Development work
Person 2 82024-01-02 Unit 2 Controlling
Person 3 82024-01-02 Unit 3 Development work
Person 4 12024-01-02 Unit 4 Administration
Person 5 22024-01-03 Unit 1 Development work
Person 3 12024-01-03 Unit 2 Traveltime
Person 4 12024-01-03 Unit 2 Development work
Person 5 22024-01-03 Unit 3 Administration
Person 1 52024-01-03 Unit 4 Administration

 

I would like to split the hours worked according to below percentage 

Unit 2 10%

Unit 3 10%

Unit 4 10%

Unit 5 20%

Unit 6 20%

Unit 7 30%

 

The information in column "owner", "date", "Object_1" and "Object_2" will remain the same.

After splitting the row, erase all raws registered in Unit 1.

 

Creating this

Owner Hours workedDate Object_1Object_2
Person 1 8 2024-01-01 Unit 1Development work
Person 1 0,80 2024-01-01 Unit 2Development work
Person 1 0,80 2024-01-01 Unit 3Development work
Person 1 0,80 2024-01-01 Unit 4Development work
Person 1 1,60 2024-01-01 Unit 5Development work
Person 1 1,60 2024-01-01 Unit 6Development work
Person 1 2,40 2024-01-01 Unit 7Development work
Person 2 8 2024-01-01 Unit 1Administration
Person 2 0,80 2024-01-01 Unit 2Administration
Person 2 0,80 2024-01-01 Unit 3Administration
Person 2 0,80 2024-01-01 Unit 4Administration
Person 2 1,60 2024-01-01 Unit 5Administration
Person 2 1,60 2024-01-01 Unit 6Administration
Person 2 2,40 2024-01-01 Unit 7Administration
Person 3 8 2024-01-01 Unit 1Development work
Person 3 0,80 2024-01-01 Unit 2Development work
Person 3 0,80 2024-01-01 Unit 3Development work
Person 3 0,80 2024-01-01 Unit 4Development work
Person 3 1,60 2024-01-01 Unit 5Development work
Person 3 1,60 2024-01-01 Unit 6Development work
Person 3 2,40 2024-01-01 Unit 7Development work
Person 6 8 2024-01-01 Unit 2Administration
Person 5 8 2024-01-01 Unit 3Administration
Person 4 1,5 2024-01-01 Unit 4Traveltime
Person 6 4 2024-01-02 Unit 1Development work
Person 6 0,40 2024-01-02 Unit 2Development work
Person 6 0,40 2024-01-02 Unit 3Development work
Person 6 0,40 2024-01-02 Unit 4Development work
Person 6 0,80 2024-01-02 Unit 5Development work
Person 6 0,80 2024-01-02 Unit 6Development work
Person 6 1,20 2024-01-02 Unit 7Development work
Person 1 3 2024-01-02 Unit 1Development work
Person 1 0,30 2024-01-02 Unit 2Development work
Person 1 0,30 2024-01-02 Unit 3Development work
Person 1 0,30 2024-01-02 Unit 4Development work
Person 1 0,60 2024-01-02 Unit 5Development work
Person 1 0,60 2024-01-02 Unit 6Development work
Person 1 0,90 2024-01-02 Unit 7Development work
Person 2 8 2024-01-02 Unit 2Controlling
Person 3 8 2024-01-02 Unit 3Development work
Person 4 1 2024-01-02 Unit 4Administration
Person 5 2 2024-01-03 Unit 1Development work
Person 5 0,20 2024-01-03 Unit 2Development work
Person 5 0,20 2024-01-03 Unit 3Development work
Person 5 0,20 2024-01-03 Unit 4Development work
Person 5 0,40 2024-01-03 Unit 5Development work
Person 5 0,40 2024-01-03 Unit 6Development work
Person 5 0,60 2024-01-03 Unit 7Development work
Person 3 1 2024-01-03 Unit 2Traveltime
Person 4 1 2024-01-03 Unit 2Development work
Person 5 2 2024-01-03 Unit 3Administration
Person 1 5 2024-01-03 Unit 4Administration
2 ACCEPTED SOLUTIONS
barritown
Super User
Super User

Hi @Emmeli,

Try this piece of code:

Result Table = 
    UNION ( FILTER ( Data, [Object_1] <> "Unit 1" ),
            SUMMARIZE (
                ADDCOLUMNS ( 
                    CROSSJOIN ( 
                        FILTER ( Data, [Object_1] = "Unit 1" ), 
                        Rules ),
                    "Hours worked upd", [Hours worked] * [Percent] ), 
                [Owner], [Hours worked upd], [Date], [Unit], [Object_2] ) )

Data is your fact table, Rules is another auxiliary table which contains units and percentage related to them (check the attached PBIX if needed).

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

View solution in original post

In this case, I'd create an additional table with the columns Owner, Object_1 and Percent and start with a merge in Power Query (Left Join on Owner). After there will be a need to create a couple of conditional columns and perform some deletions and renamings - please see the attached file and follow the Power Query steps.

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

3 REPLIES 3
barritown
Super User
Super User

Hi @Emmeli,

Try this piece of code:

Result Table = 
    UNION ( FILTER ( Data, [Object_1] <> "Unit 1" ),
            SUMMARIZE (
                ADDCOLUMNS ( 
                    CROSSJOIN ( 
                        FILTER ( Data, [Object_1] = "Unit 1" ), 
                        Rules ),
                    "Hours worked upd", [Hours worked] * [Percent] ), 
                [Owner], [Hours worked upd], [Date], [Unit], [Object_2] ) )

Data is your fact table, Rules is another auxiliary table which contains units and percentage related to them (check the attached PBIX if needed).

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

It worked really weel, thank you.

 

But I realised that i would like to be able to add that Person 6 will be split according to these separate rules.

 

Unit 2 50%

Unit 3 10%

Unit 4 10%

Unit 5 10%

Unit 6 10%

Unit 7 10%

 

And Person 5 according to these.

 

Unit 2 30%

Unit 3 10%

Unit 4 10%

Unit 5 20%

Unit 6 20%

Unit 7 10%

 

In this case, I'd create an additional table with the columns Owner, Object_1 and Percent and start with a merge in Power Query (Left Join on Owner). After there will be a need to create a couple of conditional columns and perform some deletions and renamings - please see the attached file and follow the Power Query steps.

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.