Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tamilarasu
Champion
Champion

Sum of average value in Pivot chart

Hi All,

In pivot table I need to find the total sum of average for all tables. But I got wrong value for total sum of average for each day.

Screen.PNG

Please see the attachment. Can anyone help me on this.

Thank you in advance.

Kind Regards,

Tamil

23 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Check this expression

Sum(Aggr(Avg(Sales), Country, day))/Count(Distinct day)

Regards,

Jagan.

tamilarasu
Champion
Champion
Author

Hello Mario,

Thanks and your answer really helpful. I have modified your expression like below (with Jagan's solution) but the values seems wrong. I am not sure where I am missing

IF (ColumnNo()=0, RangeSum(top(avg(Sales),1,NoOfRows())),top(Sum(Aggr(Avg(Sales), Country, day))))

Not applicable

ColumnNo() returns the values from 1 to N for the Expressions only. Value 0 doesn't exists.

Not applicable

IF (Dimensionality()=0, RangeSum(top(avg( Sales),1,NoOfRows())))

and

IF (ColumnNo()=1, RangeSum(top(avg(Sales),1,NoOfRows())),top(Sum(Aggr(Avg(Sales), Country, day))))


will give you similar results.

Not applicable

Will give you similar results but just for the 1st. Expression Column 🙂

tamilarasu
Champion
Champion
Author

Hello Jagan,

I go the count but average of days changed to sum.

Capture_2.PNG

Any Idea?

Kind Note: Is it possible to change the below expression

IF (ColumnNo()=0, RangeSum(top(avg(Sales),1,NoOfRows())),top(Sum(Aggr(Avg(Sales), Country, day))))

tamilarasu
Champion
Champion
Author

I am new to qlikview and I am not aware about this. I can see the column number is 0 for total field. I thought it will return from 0 to N. Did u check the attached file as I am getting different values.

colum.PNG

Not applicable

Tamil I got YOu:

put this

IF (Dimensionality()=0, IF (ColumnNo()=0, RangeSum(top(avg(Sales),1,NoOfRows())),top(Sum(Aggr(Avg(Sales), Country, day)))) ,Avg(Sales))

Not applicable

Yes, it is possible in Average expression write:

IF (Dimensionality()=0, IF (ColumnNo()=0, RangeSum(top(avg(Sales),1,NoOfRows())),top(Sum(Aggr(Avg(Sales), Country, day)))) ,Avg(Sales))

Not applicable

but, with my solution for all the columns and not only for column 0:

write this:

IF (Dimensionality()=0, IF (Dimensionality()=0, RangeSum(top(avg( Sales),1,NoOfRows()))) ,Avg(Sales))

in the Average Expression: