Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AVG() problem in TOTAL EXPRESSION

Dear All,

I'm getting crazy with it !

I've OrderTable with Header and Position and I'm just calculating the lead time (GoodIssueDate - InsertOrderDate) grouping it by country.

Basically I need to have an avg lead time calculation :

And I put an expression Avg(GoodIssueDate - InsertOrderDate) and it works if I select "Average" under "Total Mode" on the Expressions tab

If I select Total Expressions it give me wrong result. Problem is that if I have all the line orders items result is ok, if I have it grouped by country it give me a wrong result.

Just look to the attachment and last folder u see blank table with column AVGTOT (Total Expression) and AVGAVE (average of figure)

I tried with avg(TOTAL <some fields>... but it doesn't works

Any Idea ?

Thanks

Sergio

4 Replies
Not applicable
Author

Hi

Try changing the total mode for that expression to Avg OF ROWS in the expressions tab.

fernandotoledo
Partner - Specialist
Partner - Specialist

Hi Italian friend!

I see that there are some dates missing.

I think you should bring the difference "Date1-Date2 as DateDif" calculated in script, then use a simple AVG(DateDif) would give the correct result. Treat missing values generates a more complex and less generic chart expression.

hope it helps,

Fernando D'Agosto Yes

Not applicable
Author

Dear Nigel,

The problem it's just that. I've different behavior if in total mode I use Avg of Rows (right result) or Total (wrong result).

But I need to have the same using different classification, so it's seems that some others dimensions is creating me problem getting out a wrong result.

Sergio



Not applicable
Author

Dear all,

Thanks for all your feedback.

As suggested from Fernando I've solved it doing the calculation on script side, avoiding any duplication and dirty data.

Thanks

Sergio