Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error in expression

So I'm trying to get a variable of average worked days.
The formula I'm currently using in the pivot tables is Cycle3_stop - Cycle1_start - Count({<nome = {'Attività non lavorative'}>} distinct assign_date) and it works.
I've tried to set that variable with Avg(Aggr(Count({<nome = {'Attività non lavorative'}>} distinct assign_date))) but I get an error in expression.

Any ideas what might be wrong or how can I calculate the average in a variable with a better expression? 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

May be just this?

Avg({<nome = {'Attività non lavorative'}>} distinct assign_date)


Or, you have to put a dimension with aggr() against which you want the aggregation to work, like:


Avg(Aggr(Count({<nome = {'Attività non lavorative'}>} distinct assign_date) , YourDimension))

View solution in original post

3 Replies
tresesco
MVP
MVP

May be just this?

Avg({<nome = {'Attività non lavorative'}>} distinct assign_date)


Or, you have to put a dimension with aggr() against which you want the aggregation to work, like:


Avg(Aggr(Count({<nome = {'Attività non lavorative'}>} distinct assign_date) , YourDimension))

devarasu07
Master II
Master II

Hi,

you can try like below,

count(aggr(avg({$<nome = {'Attività non lavorative'}>} distinct assign_date),Dimension1, Dimension2))


p.s: remember to update dimension 1 & 2

also check this article,

Average – Which average?

If still not working share your mock data and expected output. tks

Anonymous
Not applicable
Author

Thanks, I forgot to add the dimension on which I need the aggregation to work