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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FRG
Resolver I
Resolver I

Calculate second filtered by text column

Hi,

In this table I have 2 users that are in place a period of time. The "PremierUserDel" is in place the number of seconds in the column "WorkingTimePremierUser".
The "DeuxiemeUserDel"  is in place the number of seconds in the column "WorkingTimeDeuxiemeUser".

Capture.JPG

 

The expecting result for the time in place for each user for this period of time should be:

Marc                      3600

Micky                     8100

Pier-Luc                 3600

Danny                    3300

Autre equipe jour  7800

Xavier                     3600

 

How to calculate that?
Thanks

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @FRG ,

We could achieve your desired output in two ways: Dax and Power query.

First way: you could create the calculated table to achieve it.

Table =
UNION (
    SELECTCOLUMNS (
        'Table1',
        "user", 'Table1'[DeuxiemeUserDel],
        "workingtime", 'Table1'[WorkingTimeDeuxiemeUser]
    ),
    SELECTCOLUMNS (
        'Table1',
        "user", 'Table1'[PremierUserDel],
        "workingtime", 'Table1'[WorkingTimePremierUser]
    )
)

The second way, you could use append query under Query Editor.

1. Duplicate the table and then remove the columns don't need.

2. Rename the name to be the same for the two table and then click Append Queries.

More details, please refer to my attachment.

Here is the output.

Capture.PNG

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @FRG ,

We could achieve your desired output in two ways: Dax and Power query.

First way: you could create the calculated table to achieve it.

Table =
UNION (
    SELECTCOLUMNS (
        'Table1',
        "user", 'Table1'[DeuxiemeUserDel],
        "workingtime", 'Table1'[WorkingTimeDeuxiemeUser]
    ),
    SELECTCOLUMNS (
        'Table1',
        "user", 'Table1'[PremierUserDel],
        "workingtime", 'Table1'[WorkingTimePremierUser]
    )
)

The second way, you could use append query under Query Editor.

1. Duplicate the table and then remove the columns don't need.

2. Rename the name to be the same for the two table and then click Append Queries.

More details, please refer to my attachment.

Here is the output.

Capture.PNG

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks! That works!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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