Currently I am trying to come up with a leave tracking system using OpenOffice Calc, so I have two sheets of data:
sheet 1:
s/n name date start date end
1 test 3 Jan 2012 3 Jan 2012 <- formatted to date format
2 test 6 Jan 2012 8 Jan 2012
while sheet 2 should look like this after I add in the formula:
name 3Jan 4Jan 5Jan 6Jan 7Jan 8Jan <- formatted to date format
test 1 1 1 1
My problem is how to use a formula on the second sheet under the dates which would refer to sheet 1 and automatically add a 1 if the person is on leave on that day. The dates will give me a serial number if I were to get the value from the cell which I use to match the dates on sheet 1 and sheet 2.
Using VLOOKUP I was able to get the value of the date start and end in sheet 1 from sheet 2:
=VLOOKUP(A2;$A$2:$D$3;3;0)
=VLOOKUP(A2;$A$2:$D$3;4;0)
and then an IF statement to add a 1 or a "":
=IF(VLOOKUP(A2;$A$2:$D$3;3;0)=MID(B1;1;6);"1";"")
However I face a problem with this part with a leave of many days (example entry 2 in sheet 1 where the leave ranges from 6 - 8 Jan).
So I tried to compare the values if the date is greater than or equal to the start date and the date is less than or equal to the end date, but failed. This is the formula I tried:
=IF(VLOOKUP(A2;$A$2:$D$3;3;0)>=MID(B1;1;6)<=VLOOKUP(A2;$A$2:$D$3;4;0);"1";"")
Can anyone can help me with this issue or have any better ideas?
Assuming s/n is in A1 of your !st sheet and Name in A1 of your second sheet, in B2 of your second sheet and copied across to suit:
=IF(COUNTIFS(first.$B1:$B99;$A2;first.$C1:$C99;"<="&B$1;first.$D1:$D99;">="&B$1)=0;"";COUNTIFS(first.$B1:$B99;$A2;first.$C1:$C99;"<="&B$1;first.$D1:$D99;">="&B$1))
Related
I do have data set with multiple date columns with different values of dates across all the months and years. I want to create a report wherein when I select a Year, I want to list the count of dates across each months on that year. Based on one Year field selection, how can I apply filter across different date fields to display the counts for that particular year
Lets say we have the data set like this
Date 1 Date 2
1/3/2017 NA
1/23/2017 1/23/2017
1/14/2017 1/16/2017
2/2/2017 2/3/2017
NA 2/21/2017
3/1/2017 NA
3/3/2017 3/21/2017
.
.
.
12/1/2017 12/12/2017
My result should look like this when I pick the year 2017
Date 1 Date 2
Jan 3 2
Feb 1 2
Mar 2 1
.
.
Dec 1 1
I was able to apply filter on one column but when I try to apply on other columns, I am not getting desired result
Assuming you want to interact with your dashboard using a parameter, you can create one string parameter in order to input the year you want to analyze.
After that you just need to create 2 calculated fields to count if that year is "contained" in your dates:
if contains(str([Date 1]),[Parameter]) then 1 else 0 end
Keep in mind that there's no gaurantee you'll get all the available months in the calendar unless you have data for all of them.
In order to consider even blank dates, I created a Date Global calculated field as follow:
ifnull([Date 1],[Date 2])
Once you've created this fields/parameter (show parameter control), you can simply add them in your worksheet ad I did in the image:
Im trying to design a dashboard wherein I need a parameter to control 2 things.
If I select "Rolling 12", I should be able to see the last 12 months of my data with respect to current month. When I select "Rolling 12-2", I should be able to see
last 12 months of my data but excluding the latest 2 months. E.g If I'm in January 2018 then I should be able to see data excluding Jan 18 and Dec 17 (from Jan 17 to Nov 17). I have tried some techniques but without success. Can anyone help. Thanks.
Reference Tableau Workbook attached at link :
Using the Superstore sample data (I don't have 10.5 installed), I created the following boolean expression which you'd put in the filter shelf for True.
Give a parameter called rolling, create calc field as follows:
if [rolling] = 'Rolling 12'
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
ELSEIF [rolling] = 'Rolling 12-2'
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
and DATEDIFF('month',[Order Date],{max([Order Date])}) >= 2
end
Adjust the date name for your date field.
I am attempting to load time series data from an excel spreadsheet into spotfire. In my spreadsheet there is a separate column for year (spotfire sees it as an integer) and month (spotfire sees it as text) since it is in the three letter abbreviation format ie January is JAN. I am trying to avoid changing the data in excel and would like to do all of my work in spotfire as this will be updated periodically. How do I link these columns in spotfire so that I can plot a variable over a time frame?
Click Insert > Insert Calculated Column... Make sure you have the right data table selected. In the Expression field type:
Date([year],
case when [month]="JAN" then 1
when [month]="FEB" then 2
when [month]="MAR" then 3
when [month]="APR" then 4
when [month]="MAY" then 5
when [month]="JUN" then 6
when [month]="JUL" then 7
when [month]="AUG" then 8
when [month]="SEP" then 9
when [month]="OCT" then 10
when [month]="NOV" then 11
when [month]="DEC" then 12 end,
1)
I would name it something like "monthdate". Note that each date will have the day equal to 1. If you also have the day in your data, just put that column in the formula above instead of the last 1.
Issue:
Need to show RUNNING DISTINCT users per 3-month interval^^. (See goal table as reference). However, “COUNTD” does not help even after table calculation or “WINDOW_COUNT” or “WINDOW_SUM” function.
^^RUNNING DISTINCT user means DISTINCT users in a period of time (Jan - Mar, Feb – Apr, etc.). The COUNTD option only COUNT DISTINCT users in a window. This process should go over 3-month window to find the DISTINCT users.
Original Table
Date Username
1/1/2016 A
1/1/2016 B
1/2/2016 C
2/1/2016 A
2/1/2016 B
2/2/2016 B
3/1/2016 B
3/1/2016 C
3/2/2016 D
4/1/2016 A
4/1/2016 C
4/2/2016 D
4/3/2016 F
5/1/2016 D
5/2/2016 F
6/1/2016 D
6/2/2016 F
6/3/2016 G
6/4/2016 H
Goal Table
Tried Methods:
Step-by-step:
Tried to distribute the problem into steps, but due to columnar nature of tableau, I cannot successfully run COUNT or SUM (any aggregate command) on the LAST STEP of the solution.
STEP 0 Raw Data
This tables show the structure Data, as it is in the original table.
STEP 1 COUNT usernames by MONTH
The table show the count of users by month. You will notice because user B had 2 entries he is counted twice. In the next step we use DISTINCT COUNT to fix this issue.
STEP 2 DISTINCT COUNT by MONTH
Now we can see who all were present in a month, next step would be to see running DISTINCT COUNT by MONTH for 3 months
STEP 3 RUNNING DISTINCT COUNT for 3 months
Now we can see the SUM of DISTINCT COUNT of usernames for running 3 months. If you turn the MONTH INTERVAL to 1 from 3, you can see STEP 2 table.
LAST STEP Issue Step
GOAL: Need the GRAND TOTAL to be the SUM of MONTH column.
Request:
I want to calculate the SUM of '1' by MONTH. However, I am using WINDOW function and aggregating the data that gave me an Error.
WHAT I NEED
Jan Feb March April May Jun
3 3 4 5 5 6
WHAT I GOT
Jan Feb March April May Jun
1 1 1 1 1 1
My Output after tried methods: Attached twbx file. DISTINCT_count_running_v1
HELP taken:
https://community.tableau.com/thread/119179 ; Tried this method but stuck at last step
https://community.tableau.com/thread/122852 ; Used some parts of this solution
The way I approached the problem was identifying the minimum login date for each user and then using that date to count the distinct number of users. For example, I have data in this format. I created a calculated field called Min User Login Date as { FIXED [User]:MIN([Date])} and then did a CNTD(USER) on Min User Login Date to get the unique user count by date. If you want running total, then you can do quick table calculation on Running Total on CNTD(USER) field.
You need to put Month(date) and count(username) in the columns then you will get result what you expect.
See screen below
I have a report I am trying to modify in Crystal. It has a data field that has a formula in it, but I want to use another formula.
This is an example of what I am trying to do.
[((# Days in January) – 15) x (Market Rent/(# Days in January))]
+ [((# Days in February) – 0) x (Market Rent/(# Days in February))]
+ [14 x (Market Rent/(# Days in March))]
I have ADO commands built out for the market rent, and a start date and end date. The months in my example are just that an example. I am not sure how to take my ADO command dates that are entered in on a filter page, and put them in a formula like the one above. Any ideas?
Also, in the first and last para. the -15 and the 14 are for a date in the middle of the month. So if the start date was on the 15th of Jan, and the End date was the 15th of march. This formula would calculate my loss of rent during vacancy.
If I'm reading your question correctly, you want to take a date field and find out how to measure the number of days in that month, the month before it, and the month after it. Here's some Crystal formulas to help you out. Let's assume your date field is called {#DateFld}:
To find the number of days in a particular month relative to a particular date, try this:
local datevar X:=cdate(dateadd("m",0,{#DateFld}));
datediff(
"d",
date(year(X),month(X),1),
date(year(X),month(X)+1,1)
)
I recommend you copy & paste this in 3 different formulas:
- In the 1st formula, replace the "0" with a -1 to get the number of days in the previous month.
- In the 2nd formula, don't change anything. That'll get you the number of days in the current month (i.e. the month that {#DateFld} is in)
- In the 3rd formula, replace the "0" with a +1 to get the number of days in the next month.
For example, if {#DateFld} is March 10th, 2011, the 1st formula will give you 28, the 2nd will give you 31, and the 3rd will give you 30.