Is there a way to set the Start Date parameter to 1, next day would be 2, next day would be 3.
I would like to group on this and do day/week/month/year summaries.
I want to change the report that is attached to be a matrix report displaying days instead of dates starting with day 1 for whatever day is chosen. To go across the columns in a matrix and then aggregate those calculations to week/month/year summaries
Current Report by Date
I used the DAY function in SSRS. DAY(Fields!created_date.Value)
Related
I have a data written in specific expression. To simplify the data, here is the example I made:
df<-data.frame(date=c(2012034,2012044,2012051,2012063,2012074),
math=c(100,100,23,46,78))
2012034 means 4th week of march,2012. Likewise 2012044 means 4th week of April,2012. I was trying to make the values of date expressing some order. The reason why I have to do this is because when I don't change them to time expressions, x axis of the scatter plot looks really weird.
My goal is this:
Find the oldest date in date column and name it as 1. In this case, 2012034 should be 1. Next, find the second oldest date in date column and calculate how many weeks passed after that date. The second oldest date in date is 2012044.So, 5 weeks after the oldest date 2012034. So it should be changed as 1+5=6. So, likewise, I want to number the date to indicate how many weeks have passed since the oldest date
One way to do it is by also specifying the day of the week and subtract it at the end, i.e.
as.Date(paste0(df$date, '-1'), '%Y%m%U-%u') - 1
#[1] "2012-03-22" "2012-04-22" "2012-05-01" "2012-06-15" "2012-07-22"
I have a column called Weekly User Escalation which is a binary column indicating whether a user has been escalated or not in a specific calendar week. 1 for yes, 0 for no.
The data's granularity is dates (in one calendar week dates can also be missing and not always equal 7 days). So, for any calendar week, I can have 1-7 rows in my dataset.
Now, I want a column which sums up the escalation levels per user per CW. I.e., if User 1 has been escalated in Calendar Week 1 and 2 and not in CW 3, it should return 1+1+0=2, and so on.
What I tried already is this:
CALCULATE(SUMX('Data', MAX('Data'[Weekly User Escalation])), ALLEXCEPT('Data', 'Data'[User], 'Data'[Calendar Week]))
The output shows the sum of all the 1s and 0s in for that user, which in my case shows 13, since there were 13 rows which were "1" for a particular CW in my dataset. I want that only the MAX value from the column Weekly User Escalation, which is always 1, is counted AND ONLY ONCE for every CW.
Try with:
WeekWithEscalation = CALCULATE( Countrows( VALUES('Data'[Calendar Week]), 'Data'[Weekly User Escalation] = 1 )
If we put to visualization UserName and measure [WeekWithEscalation] that should work.
Is there a way to window filter dates by a number of days excluding weekends?
I know you can use the between function for filtering between two specific dates but I only know one of the two specific dates, with the other date I would like to do is 4 days prior in business days only (not counting weekends).
An pseudo-example of what I am looking for is, given this wednesday I want to filter everything up to 4 business days beforehand:
window(z, start = as.POSIXct("2017-09-13"), end = as.POSIXct("2017-09-20"))
Another example would be if I am given this Friday's date, the start date would be Monday.
Ideally, I want to be able to play with the window value.
I tried to group my daily data by week (given a reference date) to generate a smaller panel data set.
I used postgres before and there it was quite easy:
CREATE TABLE videos_weekly AS SELECT channel_id,
CEIL(DATE_PART('day', observation_date - '2016-02-10')/7) AS week
FROM videos GROUP BY channel_id, week;
But it seems like it is not possible to subtract a timestamp with a date string in Drill. I found the AGE function, which returns an interval between two dates, but how to convert this into an integer (number of days or weeks)?
DATE_SUB may help you here. Following is an example:
SELECT extract(day from date_sub('2016-11-13', cast('2015-01-01' as timestamp)))/7 FROM (VALUES(1));
This will return number of weeks between 2015-01-01 and 2016-11-13.
Click here for documentation
I am needing to count month between collect dates. I need to know if the test was run in the last 3 months. Below is the code I used but it is giving me a count of zero, but I know they had 3 of the same tests run in a year because I can see the dates. I understand the first one have a count of zero, because there is no test before that, but the count for the other should be 3, 5 respectively.
DATEDIFF('month',[Collect Date],[Collect Date])
Dates of the Tests.
1/8/2015
4/23/2015
9/30/2015
What you are looking for is possible using the LOOKUP function in Tableau. Keep in mind, that the result relies heavily on the data that is displayed and how it is displayed (sorted, etc).
You can create a calculated field like this:
DATEDIFF("month",LOOKUP(ATTR([Test Date]),-1),ATTR([Test Date]))
Which calculates the number of months between the date in the current row and the date from the prior row.
Your result will look something like this: