Forum Discussion
Generateseries with Dates
- 2 years ago
That worked! I only had to add Datevalue() to my date dim column, see below. Thanks so much!
Column Flag For Rolling prev 3 Quarters and current QTD =var q = QUARTER(EDATE(TODAY(),-9))var y = YEAR(EDATE(TODAY(),-9))return if(DATEVALUE([CAL_DATE_YR_MTH_DAY_E]) >= DATE(y,q*3-2,1) && DATEVALUE([CAL_DATE_YR_MTH_DAY_E])<= TODAY(),1,0)
ok, so using this:
You need previous three quarters and current quarter to date?
- mcguija2 years agoHelper III
Yes, that's correct.
- lbendlin2 years agoSuper User
Rolling prev 3 Quarters and current QTD = var q = QUARTER(EDATE(TODAY(),-9)) var y = YEAR(EDATE(TODAY(),-9)) return GENERATESERIES(DATE(y,q*3-2,1),TODAY()) - mcguija2 years agoHelper III
Hi, I think we are super close, now an error is thrown, I added your column and also broke it down to see variable values, see error below.
"a table of multiple values was supplied where a single value was expected"
- lbendlin2 years agoSuper User
Please be more precise in your requirement.
Column Flag For Rolling prev 3 Quarters and current QTD = var q = QUARTER(EDATE(TODAY(),-9)) var y = YEAR(EDATE(TODAY(),-9)) return if((Date_Dim[CAL_DATE_YR_MTH_DAY_E]) >= DATE(y,q*3-2,1),1,0) - mcguija2 years agoHelper III
Hi, sadly this doesn't work either, it shows the correct start date of 2023-04-01 but the end date is way into the future - in fact all the was to the end of our date dim, where it should stop at todays date, 2024-01-12.
- lbendlin2 years agoSuper User
.
Column Flag For Rolling prev 3 Quarters and current QTD = var q = QUARTER(EDATE(TODAY(),-9)) var y = YEAR(EDATE(TODAY(),-9)) return if([CAL_DATE_YR_MTH_DAY_E]) >= DATE(y,q*3-2,1) && [CAL_DATE_YR_MTH_DAY_E]<= TODAY(),1,0) - mcguija2 years agoHelper III
hmm, something is missing, throwing errors.
- lbendlin2 years agoSuper User
Column Flag For Rolling prev 3 Quarters and current QTD = var q = QUARTER(EDATE(TODAY(),-9)) var y = YEAR(EDATE(TODAY(),-9)) return if([CAL_DATE_YR_MTH_DAY_E] >= DATE(y,q*3-2,1) && [CAL_DATE_YR_MTH_DAY_E]<= TODAY(),1,0) - mcguija2 years agoHelper III
That worked! I only had to add Datevalue() to my date dim column, see below. Thanks so much!
Column Flag For Rolling prev 3 Quarters and current QTD =var q = QUARTER(EDATE(TODAY(),-9))var y = YEAR(EDATE(TODAY(),-9))return if(DATEVALUE([CAL_DATE_YR_MTH_DAY_E]) >= DATE(y,q*3-2,1) && DATEVALUE([CAL_DATE_YR_MTH_DAY_E])<= TODAY(),1,0)