Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
503 views
in Technique[技术] by (71.8m points)

powerquery - PowerBI Working hours calculation without start end time

I have this table with only start time of every task. What I want to do is to calculate for every user his starting time (doesn't matter what task) and end time (doesn't matter what task). Basically I want working hours for each day for each each user.

Data Table

I tried to do this:

    enter work = MINX(
    SUMMARIZE(events,events[Date Only].[Date],events[user_id],
        "MINN",MIN(events[ConvertedTimeToInteger])
    ),
    [minn]
)

    exit work = MAXX(
    SUMMARIZE(events,events[Date Only].[Date],events[user_id],
        "MAXX",MAX(events[ConvertedTimeToInteger])
    ),
    [MAXX]
)

It works for a daily calculation, but for a total calculation its not good as it takes min/max of the date period: Table Results

Any help much appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ok, I have found a solution!

I had to summarize by 2 columns :

duration = SUMX(SUMMARIZE(events,events[date].[Date],events[user_id],"datesesese",DATEDIFf([Enter time],[exit time],HOUR)),[datesesese])

Solution


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...