Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin 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.
Hi,
I have data which shows shift hours, but I need to convert that to a shift quantity (or percentage of the shift on that day for that person). The issue I have is when there are 2 shift types on one day (ie: they might attend work and then leave part way through), so I need to show 0.# worked and 0.# unplanned leave.
Columns A-D are what comes from a report.
Columns E & F are how I would do it in excel. If anyone can tell me how to do it in Power BI it would be greatly appreciated.
Thanks in Advance. 🙂
Solved! Go to Solution.
Hi @bree_carter
Please try this:
With your data, I create a calcualte column:
Calculated Shift =
VAR _sumHours = CALCULATE(
SUM('Table'[Hours]),
FILTER('Table',
'Table'[Date]=EARLIER('Table'[Date])
&&
'Table'[Employee Id]=EARLIER('Table'[Employee Id])
)
)
//Get the sum of the Hours separately
RETURN 'Table'[Hours]/_sumHours
Select the Column(Calculated Shift) > Column tools > Change the Display the values in this column with commas as a thousand separator to 2
The result is as follow:
Best Regards,
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bree_carter
Please try this:
With your data, I create a calcualte column:
Calculated Shift =
VAR _sumHours = CALCULATE(
SUM('Table'[Hours]),
FILTER('Table',
'Table'[Date]=EARLIER('Table'[Date])
&&
'Table'[Employee Id]=EARLIER('Table'[Employee Id])
)
)
//Get the sum of the Hours separately
RETURN 'Table'[Hours]/_sumHours
Select the Column(Calculated Shift) > Column tools > Change the Display the values in this column with commas as a thousand separator to 2
The result is as follow:
Best Regards,
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is PERFECT! Thank you so much. I really appreciate your time and help.
Thanks and apologies.
I have a payroll extract that shows hours per person per day. A person may have more than one type of entry for a day (shown in the yellow highlight above). IE: in one day, a person may have some worked hours and some paid leave hours.
I need to convert this information:
What I am trying to obtain is in column E in the above image.
An example would be: on 01/01/24, EMP001 worked 0.7 of a shift and had 0.3 of a shift as LWOP -Planned.
The headings are as per the report that comes out of the system.
Data is below. Thanks for your time. 🙂
Employee Id | Date | Hours | Time Off Name | Calculated Shift |
EMP001 | 1/01/2024 | 8 | Worked Shift | |
EMP001 | 1/01/2024 | 4 | LWOP - Planned | |
EMP001 | 2/01/2024 | 12 | Planned Annual Leave | |
EMP001 | 3/01/2024 | 12 | Worked Shift | |
EMP001 | 4/01/2024 | 12 | Worked Shift | |
EMP001 | 5/01/2024 | 5 | Personal Leave - Unplanned | |
EMP001 | 5/01/2024 | 5 | LWOP - Unplanned | |
EMP001 | 6/01/2024 | 12 | Worked Shift | |
EMP002 | 1/01/2024 | 10 | Worked Shift | |
EMP002 | 2/01/2024 | 10 | Worked Shift | |
EMP002 | 3/01/2024 | 10 | Planned Annual Leave | |
EMP002 | 4/01/2024 | 12 | Worked Shift | |
EMP002 | 5/01/2024 | 12 | Personal Leave - Unplanned | |
EMP002 | 6/01/2024 | 7 | Worked Shift | |
EMP002 | 6/01/2024 | 4 | LWOP - Unplanned |
We want to help you but your description is too vaugue. Please write it again clearly.
We are Power BI expets but we dont know what you want your reports to do.
Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Remove any unneeded columns which may cause confussion.
Rename columns to user friendly names.
Also provide the example desired output, with a clear description of the process flow.
Show step-by-step calulations.
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gerrting free expert help, so please put lots of proper effort to asking questions and providing example.
Vaugue descriptions can waste your time and ourtime.
Look foward to helping you when the above information is forthcoming
We want to help you but your description is too vaugue. Please write it again clearly.
We are Power BI expets but we dont know your jargon like LWOP or what you want your reports to do!
Please ask a colleagueto manager to read your question, and help you write it for an external reader.
Why does 01/01/24, EMP001 = 0.7and 0.3 ???
Provide a clear step-by-step description of the process flow.
Show step-by-step calulations.
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you. T
Try include all the details in one post, so we dont have to scrool up and down to try fathom wahat you want.
Try keep it concise and simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gerrting free expert help, so please put lots of proper effort to asking questions and providing example.
Vaugue descriptions can waste your time and ourtime.
Look foward to helping you when the above information is forthcoming
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
11 | |
10 | |
9 | |
8 |