Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am facing some problem.
Below is my table:
Date Price
6/30/2016 | 207.210007 |
6/29/2016 | 204.839996 |
6/28/2016 | 201.479996 |
6/27/2016 | 201.589996 |
6/24/2016 | 203.630005 |
6/23/2016 | 209.809998 |
6/22/2016 | 208.649994 |
6/21/2016 | 208.300003 |
Problem 1 I cannot calculate moving average 10 days in script, I only can moving average 2 days
rangeavg(Price,previous(Price)
Problme 2 Since I dont create the moving average field in the table but I want to add (Price > Moving average 10days Price) as calculated dimension
that is
=if(rangeavg(above(sum(Price),0,10))>0,1,0)
Can anybody give me some advices?
Thanks!
Try this: rangeavg(above(sum(Price),rowno(),10))
- Marcus
Is it possible to share a sample with the desired output if what marcus_sommer has provided doesn't work for you?
Best,
Sunny
It is work in the expression but it doesnt work in calculated dimension
Hi Garnett,
Please find attached the qvw.
Hope this helps to solve your 1st query.
If you want to use aggregations within the dimension you will need to wrap the calculation within an aggr-function:Calculated Dimensions
- Marcus
Thanks!
Thanks!
If your question is now answered, please flag the Correct Answer and possible Helpful answers.
If not, please make clear what more information on this topic you are looking for .
Hi@Garnett,
Having complex expression only will degrade your dashboard performance
Add the DateGroup to your load script as below
DATA:
LOAD
Date,
Price,
date(subfield(class(Date,10),' ',1),'DD-MM-YY')
&' TO '&
date(subfield(class(Date,10),' ',5),'DD-MM-YY') as DateGroup
FROM TABLENAME;
LEFT JOIN(DATA)
LOAD DateGroup,
Avg(Price)
RESIDENT DATA
Group BY DateGroup;
This should simplify your calculations