Calculation of the absence rate per employee - excel

The goal is to use Dax and Power Pivot to determine what the absentee rate per employee is. This lowest granularity can be used later to determine the average absence per area.
I get from the team leaders an overview (Excel), which is shown per day, whether the employee was there on the day or sick or on vacation
tblOverview
Date - Name - State - Area - Shift
Date: Date from 01.01.- 31.12.
Name: Name of the person
State: A = present, E = absent
Area: area
Shift: Week shift or weekend shift (Mo + tue day off)
Since the employees have different shift models, this is probably a somewhat more difficult task. Most work from Monday to Friday. However, some work from Wednesday to Sunday.
Somehow I have to find out how many working days each employee has per week / month and how many days he has been absent. Only how best?
Can this be elegantly solved using a Dax function without adjusting the structure of the table?
I am happy about every contribution!
Edit:
The first pivot table shows how many days every employe have worked ("A") per week.
The second pivot table shows the absence days ("E"):
enter image description here
The result should be shown in the same structure.
First, the function should compare if the day for each employee is a working day in comparison to the shift model (either mo-fri or wed-sun) and then if the employee is off ("E"). If the employee is off, the availability should be 0% or the absence 100% for the respective day.
Here you have an example table/ file:
enter link description here

Related

MS Excel sorting formula

Microsoft money used to be a brilliant programme for keeping track of a pension portfolio in that it showed value change weekly, monthly, 3 monthly and year to date, now it is no longer supported I have been trying to find an alternative. I now have an I Mac with MS excel on but am trying to do a sort and display on the following and try keep track as per MS Money did.
[Sample][1]
This data is updated weekly and would like to know if it is possible to replicate MS Money.
[1]: https://i.stack.imgur.com/BLahL.png
ok so lets try the things you said about and see if we can get you close:
name the ranges (link) dates and values
weekly movement (current value / value 1 week ago):
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-7,values)
1 month movement:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-EDATE(MAX(dates),-1))/7,0)*7,values)
3 month movement:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-EDATE(MAX(dates),-3))/7,0)*7,values)
ytd:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-DATE(YEAR(MAX(dates)),1,1))/7,0)*7,values)
this assumes those named ranges and that the date is exactly every 7 days apart. if also looks for the closest date to 1 month ago, 3 months ago and start of year.
also it does a current value as percentage of the start value for the period

Cognos Report totaling hours over time

I'm pretty new to Cognos 10 Report Studio so this may be a fairly simple question but I have been unable to find on answer so far.
In my database I have the hours a person has worked in a two week pay period, as well as what month a pay period exists in. I would like to total the over any period of months.
For example a user is prompted to choose a range of time, and they may select a start month of January of some year, and an end date of June of the same or some later year, and then the report would have a column that displays the sum of hours worked by a person between that time frame.
So in essence the sum of hours for every pay period in a given range of dates.
Thank you very much for your help.
If you want a list (or crosstab) with the User, year, month, and total hours in each month
Create a new data item (maybe something called - Hours by Month) defined as:
total([hours] for [Year], [Month], [User])
The function allows you to define the scope so the SQL is structured to give you the answer grouped the way you want

DAX year over year comparison

In a report that I am making in DAX I would like to have year over year comparison of a measure defined as:
Sales Count := CALCULATE(COUNT(fData[PN]);fData[Proc.Type]="CU")
This measure basically counts the amount of sales that were generated. I have a dataset that spans from the beginning of 2014 up to today (16/01/2018). My calendar table consists of a date column, a year column and a month column and is ranges from 01/01/2014 up to 31/12/2018 (to avoid contiguous date errors when using time intelligence functions).
I have defined a measure called PY Sales count as:
PY Sales Count := CALCULATE([Sales Count];SAMEPERIODLASTYEAR(dCalendar[Dates]))
This measure does the job I want it to do, aside from one issue. When comparing the month of january of this year to the month of January to last year, it appears that we are doing terrible. This is because the SAMEPERIODLASTYEAR function considers the FULL month of January for the year 2017 and compares it to the period from the first of January until the 16th of January (today).
I think I should thus try to build a custom measure to 'filter' the date table such that when the year over year measure considers the running month, it only takes the same period as the one on which sales were recorded to compare against, not the full period...
However, due to my sparse DAX experience, I cannot seem to get this right...
If anyone could help/assist me on this, that would be hugely appreciated!
Thanks in advance
I haven't had a chance to test this, but try something along these lines:
PY Sales Count := CALCULATE([Sales Count];
FILTER(dCalendar;
dCalendar[Dates] <= DATEADD(TODAY(), -1, year);
SAMEPERIODLASTYEAR(dCalendar[Dates])))

Calculate annual leave between two dates in Excel

This task seems easy enough yet I just can't figure a way of doing this without resorting to vba.
All I need is to know the number of hours an employee has used up on annual leave, based on a start and end date, and their hours of work.
To be more clear, this example shows one employees contracted hours from Monday to Sunday i.e. they work only Weds, Thurs, and Friday, for 7.5 hours each day.
Below shows the start and end date that the employee has chosen to take for annual leave. I need to calculate, based on their contracted hours, how much annual leave is used between the two dates. The answer would be 45 hours in this case.
Here's another approach - I've expanded the days between the start and end dates into an array then used the resulting day numbers to offset into the days of work range
=SUMPRODUCT(N(OFFSET(A3,0,WEEKDAY(ROW(INDIRECT(A6&":"&B6)),2)-1)))
If you had a list of holiday dates somewhere (say in I3:N3) you could exclude them as follows
=SUMPRODUCT(N(OFFSET(A3,0,WEEKDAY(ROW(INDIRECT(A6&":"&B6)),2)-1))*ISNA(MATCH(ROW(INDIRECT(A6&":"&B6)),I3:N3,0)))
- it is a bit long-winded but the only way I can think of at the moment.

Powerpivot data that spans over multiple filter values

I have outage information stored in Excel Powerpivot. I am trying to use Powerpivot to display and calculate uptime availability per month, however, I am a bit stuck with outages that spans over two months.
My current setup:
Outage table has four columns: Application, Outage Start Time, Outage End Time, Duration. Duration is a calculated column that is the difference between the end time and start time.
The Outage Start Time is connected to a date table. I have slicers per month, so users can select the month they like to see availablity data, and powerpivot table will show availability for that month for different applications.
If the outage start time and end time falls within the same month, then availablity calculation is correct. However, for example, if the outage starts at the end of July and ends at the beginning of August, then this is only considered to be an outage for July (because of how the start time is tied to the date table). Ideally, I would like to see the duration of this outage split up over both July and August. Is this possible?
Thanks!
Tallie,
It's absolutely possible! I solved it by creating 2 calculated columns on the Outage Table:
One to determine the duration of the outage in the current month:
=if([End]>EOMONTH([Start],0),EOMONTH([Start],0)-[Start],[End]-[Start])
And another to determine the outage in the following month:
=if([End]>EOMONTH([Start],0),[end]-EOMONTH([Start],0),blank())
It then becomes the slightly more complex where I want to create a measure that not only sums the current month outage but also the following month outage from the previous month. I began by creating a measure that sums each of the 2 calculated columns respectively - this is good practice as it helps a logical build up and improves performance:
[Cur Month Dur] = sum(Outage[Cur Month Outage])
[Following Month Dur] = sum(Outage[Following Month Outage])
I then add to the [Cur Month Dur] a filtered version of the [Following Month Dur] which opens the filter context of the measure and looks in the date table for the previous month (must be numeric):
=[Cur Month Dur] +
CALCULATE([Following Month Dur],
FILTER(
ALL(dimDate),
dimDate[Month Number]=max(dimDate[Month Number])-1
)
)
You can find a detailed explanation of the method here.
I uploaded my workings to SkyDrive which you might find useful.
HTH
Jacob

Resources