Cognos Report totaling hours over time - cognos

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

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

Calculation of the absence rate per employee

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

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.

Excel - Find if worker has worked certain OT if weekday and or Sunday

I have a worksheet with days running along the columns, within each day there are different hourly categories, 130%, 150%, 200% and 215% etc, there are other categories within each day, but these are not to be included. (Can't post Image as new, can email?)
If a worker works over 3.5 hours in any of these categories they get an extra lunch, except on Sunday's where they must work 4 hours.
I've been using countif's to check each day over 3.5, and another column for Sunday's.
The weekday and Sunday can be combined into the same column as the lunch price is still the same, just number of working hours different.
The main problem is I have to adjust the countif's every month, I want something that will look at days of the week and/or sunday's and check without adjusting every month.
Have been trying to get my head around sumproduct with countif!
Any help, very much appreciated.
Thanks!
Since you have not mentioned what is where this might take some adjustment, but may get you started:
=IF(SUM(B3:G3)>=IF(WEEKDAY(B$1)=1,4,3.5),"lunch","no lunch")

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