Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the below expression but want to add this into the script. How would one write this? I also would like to remove zero values from the average.
Chart Properties Expression below:
Dimensions: Program
Avg({<ENROLLMENT_STATUS = {'Closed'},REASON ={'a','b'}>}DAYS)
May be like this:
LOAD Program,
Avg(DAYS) as AverageDays
RESIDENT YourTableWithAllFields
WHERE DAYS <>0 AND ENROLLMENT_STATUS = 'Closed' AND MATCH(REASON, 'a','b')
Group By Program;
UPDATE: Used Stefan's code and added the Program as the dimension
Do you need a level of aggregation?
Put another way, where did you use this in the front end? A chart or text box object? If it was in chart, what were the dimensions?
Guessing from the sparse information provided, something like
LOAD
AVG(DAYS) AS AverageDays
RESIDENT YourTableWithAllFields
WHERE DAYS <>0 AND ENROLLMENT_STATUS = 'Closed' AND MATCH(REASON, 'a','b');
I see. I have updated my question. This was in the Chart Properties and my dimesion field is "Program". I would like the avg to calcuate based off my selections from the list box, but need to only avg when. Enrollment status = 'Closed', Reasons = 'a','b' and Days <> 0
May be like this:
LOAD Program,
Avg(DAYS) as AverageDays
RESIDENT YourTableWithAllFields
WHERE DAYS <>0 AND ENROLLMENT_STATUS = 'Closed' AND MATCH(REASON, 'a','b')
Group By Program;
UPDATE: Used Stefan's code and added the Program as the dimension
Why don´t just this into your graph?
Avg({<ENROLLMENT_STATUS = {'Closed'},REASON ={'a','b'},DAYS=[">0"}>}DAYS)
I could and it's nice to now know the syntax. Are there advantages and disadvantages in doing this?
Thanks, I'm almost there. I have in my where clause the string don't. I believe the apostrophe is throwing an error. Is there a way for QV to except the apostrophe. I tried to use Double quotes, but that's not working!
Try to use two single quotes within the string literal (and enclose with single quotes around).