How to create a 'past 3 months' time period in Google Data Studio - date-range

I'm trying to have my line chart show data for the past 3 months. GDS has a 'last quarter' date range, but this shows me Q1, Q2, Q3, or Q4. What I need is the data for the past 3 full months (not counting the current month). I tried creating a calculated field but the documentation isn't proving very useful for the matter at hand.
eg. If the current date is Feb-20, I want to show data from 'Nov 1 - Jan 31'. Also need to compare to same period from last year.
Can anyone help? Thanks in advance!

I don't think this is possible in the way you're describing. You can achieve the same by creating a metric in your data source and then applying a filter at the page / chart / report level to remove data which doesn't meet your criteria

You can use the option "advanced" in the date dropdown and set the start date to today minus 3 months.

Related

Excel formula for entering bi-weekly dates

I have the following worksheet:
The grid is filled with the following formula (this example is from cell H4) that populates the grid based on inputs from the table on the left, =IF($A4="","",IF(AND($E4="Daily",H$2>=$D4,H$2<=$G4),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Weekly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"DDD")=TEXT($D4,"DDD")),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Bi-Weekly",H$2>=$D4,H$2<=$G4,MOD($D4+14,H$2)=0),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Monthly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"MM/DD/YYYY")=CONCATENATE(TEXT(H$2,"MM"),"/",TEXT($D4,"DD"),"/",TEXT($D4,"YYYY"))),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(COUNTIF('PowerPoint Gantt'!$A$5:$A$12,$A4)=1,IF(H$2=VLOOKUP($A4,'PowerPoint Gantt'!$A$5:$E$12,5,FALSE)+31,"R",""),""))))))
The only part of the function that isn't working is the Bi-Weekly selection. I can't figure out how to get recurring entries. I can get the start date and one 14 day period after. I've tried using the CEILING function also but still only gets me the next 14th day marked, instead of every 14th day. And ideas?
In your rule for Bi-Weekly meetings, it seems that
MOD($D4+14,H$2)=0
should be replaced with
MOD(H$2-$D4,14)=0
The latter takes the difference between the starting date and the actual date and checks to see if that can be divided by 14, the number of days in 2 weeks.
Your rule for Weekly meetings could be approached similarly, which seems simpler to me than a rule based on the name of the day, like you are using now.

How to count entries on monthly basis? Such that same row/entry can be counted in multiple months if conditions are met

I am trying to make a bar chart with X- axis showing timeline with respect to months (Jan, Feb, March etc). On Y-axis, I want to count how many [KRI] are there in each month based on their [Status Category]?
I have two conditions though:
1) If [Status Category] is 'Final', count that KRI in all months between [TRIGGERDATE] month and [statchedate]. for example, same KRI should be counted in Jan, and Feb and March etc (from time it was open till the time/month it was closed).
2) If [Status Category] is NOT Final, count that KRI in all months between [TRIGGERDATE] month and today's month.
In the picture below with the data sample, the pink colored blocks shows when the KRI should NOT be counted in that particular month.
I am trying to write a custom expression using if statement, but I am not able to figure out how would spotfire know that a KRI should be counted between [Triggerdate] and [Statchedate]? Or for instance, between [Triggerdate] and [today]
I am also thinking about adding a calculated column that will determine if the KRI should be counted in how many months? (but this will be ongoing data, so I am afraid that my column would keep on expanding..)
Any suggestions would be very much appreciated :)

Calculate average based on a value column (count) in a pivot table

I'm looking a way to add an extra column in a pivot table that that averages the sum of the count for the months ("Count of records" column) within a time period that is selected (currently 2016 - one month, 2017 - full year, 2018 - 5 month). Every month would have the same number based on the year average, needs to be dynamically changing when selecting different period: full year or for example 4 months. I need the column within the pivot table, so it could be used for a future pivot chart.
I can't simply use average as all my records appear only once and I use Count to aggregate those numbers ("Count of records" column).
My current data looks like this:
The final result should look like this:
I assume that it somehow can be done with the help of "calculated filed" option but I couldn't make it work now.
Greatly appreciate any help!
Using the DataModel (built in to Excel 2013 and later) you can write really cool formulas inside PivotTables called Measures that can do this kind of thing. Take the example below:
As you can see, the Cust Count & Average field gives a count of transactions by month but also gives the average of those monthly readings for the subtotal lines (i.e. the 2017 Total and 2018 Total lines) using the below DAX formula:
=AVERAGEX(SUMMARIZE(Table1,[Customer (Month)],"x",COUNTA(Table1[Customer])),[x])
That just says "Summarize this table by count of the customer field by month, call the resulting summarization field 'x', and then give me the average of that field x".
Because DAX measures are executed within the context of the PivotTable, you get the count that you want for months, and you get the average that you want for the yearly subtotals.
Hard to explain, but demonstrates that DAX can certainly do this for you.
See my answer at the following link for an example of how to add data to the DataModel and how to subsequently write measures:
Using the Excel SMALL function with filtering criteria AND ignoring zeros
I also recommend grabbing yourself a book called Supercharge Excel when you learn to write DAX by Matt Allington, and perhaps even taking his awesome online course, because it covers this kind of thing very well, and will save you significant head-scratching compared to going it alone.

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.

Time series mock data generation for 16 years of quarterly data in Excel or Matlab

I would like to generate a mock time series quarterly dataset from, say, 2000-2016 for a variable (quarterly credit growth) that averages around a certain value (say, 30%). Can anyone give a suggestion on how to do this in principle?
Edit: what I was implying were the actual data values for each time period, i.e. data with a certain mean and variance.
Found a solution with a code in Matlab, for anyone interested, see below in answers.
Excel approach:
You can make column A your date list. In A1, or A2 or more if you have header rows, you will have to seed your list by providing the first start date. Lets assume you put your seed date in A2. I would then go about adding 3 month to you start date using a formula, and copy down until you have hit your desired date. In order to add the 3 months I would use the following in A3.
=date(year(A2),Month(A2)+3,day(A1)
that will give you the first day of the month every 3 months. If you want the first day of the month every 3 months, set the day to 1 like so:
=date(year(A2),Month(A2)+3,day(A1)
And end of month could be calculated as:
=eomonth(date(year(A2),Month(A2)+3,day(A1)),0)
however I would prefer to do the end of month calculation based on the row you are in so I would do it more like:
=EOMONTH($A$2,(rows($A$2:A3)-1)*3)

Resources