excel pivot tables grouping dates by their relation to present day - excel

I'm creating a file to track the dates and times of arrival of documents. THe data that I have is fed to the pivot table. The options for grouping data allow me to group them by days, months etc. What I need to achieve is different.
I would like the dates to be grouped as follows (by arrival date):
-today,
- yesterday,
- two days ago,
-more than two days ago.
I tried to create calculated fields but I was unable to write a proper formula.
Is there any way to achieve that?
Thanks.

If the dates are in the column A, I would write sometnihg along the lines of:
=IF(TODAY()-A1=1,"yesterday",IF(TODAY()-A1=2;"two days ago");"more than two days ago")
It is hard to give a definitive answer because you didn't provide any insight into what your data looks like, like a screenshot.

Related

How to Group Measures and Make Columns Table Source Name

I'm new to Tableau! I hope this is a simple answers. Thanks in advance!
I'm working with employee data and I need to create a matrix of headcount totals across years and months.
Final Matrix Output Example
I'm starting with 6 tables listing all active employees at the beginning of each year from 2015 through 2020. I then have a list of employees and the date that were hired; so all employee additions. I then have the same thing for terminations. All 8 of these tables are in the same Excel file but different tables.
List of Data Tables
How can I take this data and create the matrix I linked above? I've tried creating calculated fields to count the number of active employees for each time period, but I can't then seem to get the matrix to organize itself correctly in a table.
Current Status
I feel like the easiest solution would be to query this so that I just have a snapshot of all active employees at the beginning of each month and year with month and year columns, but I'm not sure how to convert what I have now, into that sort of structure.
Thanks again.
I fear you have to extensively restructure your data before proceeding to build a view/crosstab, as is evident from the current status of your data (screenshot shared by you). You can do it much easily in excel. Meanwhile, I recommend/suggest you to read the paper by Hadley Wickham, renowned statistician/data scientist at this page https://vita.had.co.nz/papers/tidy-data.pdf
Still, I am trying to give you the steps which you can follow-
Step-1 Rename all columns of headcount tables by removing years from these. (Keep year names in sheets instead). This will give same column names for your all headcount tables.
Step-2 UNION all these headcount tables in data-tab of tableau. Keep sheet_names in a separate columns which will later-on be used to extract years' values.
Step-3 PIVOT all months columns to rows (In data tab only)
Step-4 Extract year names from file/sheetname column
Step-5 This will give a table structure with three useful columns to build your crosstab i.e. 1. Year (to be placed in columns); 2. Months (to be placed in rows) and 3. Headcount value (to be placed on viz/text marks card)

Pivot Chart - 3 date columns, how to show counts of the dates by month?

My goal is to have a count of three different dates by month in a bar chart. Currently we are using a count if formula then building the chart above that, would like a cleaner solution. I have three columns, Open, Action, and closed dates. Adding all three to the axis doesn't produce the right results. I'm stuck. Is there something in the pivot that I can change? I'm pulling the data in via Power Query, is there something there I can change? Many thanks :-)
Ideal state
Recent Action and Closed dates are not show up, that seems to be the real issue. Why and how to fix it?
Sample of data
Created a date table in Power Query.
Also in Power query, duped my data then deleted all but the columns I didn't need.
Unpivoted the three date columns.
Joined the new date to the date table.
Graphs fine.

Editing formula within multiple calculated fields concurrently

I have a pivot table with monthly run-rate forecast.
e.g. on the 5th of Jan it would be [number]/5 *31
I change it every week so 5th/ 12th/19th etc.
Only problem is I have lots of fields like this and lots of tables and lots of sheets. Is there any way to update the calculated fields in bulk?
Thanks
You should consider now() formatted to give the week. Then call that value in your calcs... should update with every change of week

Filtering specific individual dates in PivotTables with changing input

How do I filter data for specific individual dates in a PivotTable? The input is changed on a weekly basis and therefore the specific desired dates will change every week. I have data for every business day. And I want to retrieve data from the most recent business day, 5 business days before that, 30 business days before that and 90 business days before that. How do I go about this?
Sound like you want an 'Aging Report' If you Google on 'Excel Aging Report', you should be able to find something. use of TODAY() in formula is part of answer. I also did something similar here. It didn't involve Pivot tables.. But it should help you on your way.
You might want to check out the code in my answer at Filtering pivot table with vba
That code lets you programatically filter a Pivot RowField or ColumnField by specifying an interval type (e.g. days, weeks, months, quarters, years) as well as an interval count (e.g. 7, -7). It has an optional argument vRelativeTo field which counts back/foward from the youngest/oldest item depending on whether lNumber is positive/negative.
It leverages off the inbuilt DateFilters functionality, and as such does not
work on RowFields.

Attendance Calculations / Period Calendar

This is a multi-tiered project. Let me give a quick overview. I have attendance data, card/ timestamp punches. I would like to have a pivot table with slicers in Excel. Ideally you'd be able to choose a department / last name / associate number. And also a period of time. Ideally this would be a table with the company period/week. And maybe default to last weeks.
I can get at timecard data in two ways:
(1) generate a CSV that automatically performs the timecard math, to figure out how many hours someone worked and it is smart enough to understand 3rd shift workers. The format of that CSV is:
Last Name, First Name, Personnel Type, Associate Number, Facility, Department, TimeIn, TimeOut, Total Hours
The problem with this method is that I would have to manually append the information to the CSV tables. Or come up with some autoIT script.
(2) Get at the raw data via sql/odbc. This way the math is not done. It is just all of the associates timestamps. I would have to figure up the daily hours myself and figure out a 3rd shift formula too. It is not a set schedule, many people swing shifts and others get called in a lot.
Lastly, I would like to be able to filter the dates by using our company fiscal calendar. I have a spreadsheet that goes from 2000 to 2093. With everyday listed and it's corresponding year/period/week.
Example period info spreadsheet:
date Year Period week WeekTotal Period Total
12/3/2007 2008 1 1 2008.1.1 2008.1
12/4/2007 2008 1 1 2008.1.1 2008.1
I know there is a lot going on here, but what would be the best way to approach this project?
First I have not been able to post any script however the last I tried it I used two options 1. Was a php conversion where the time was numbers ( which makes it easier for calculations)
2. Was in the tables where I deliberately entered the values places the time in different columns or fields for hours, mins, and seconds this meant that while the input is eased I still have to calculate the output in php especially for totals, averages and differences.
Hope it helps a bit

Resources