Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
EliranMoshe
Contributor
Contributor

total row in table show average instead total

hi.

 

i have a table that calculate monthly data

i have a column the make a average of area data.

in the total row it's show the average instead a total

 

EliranMoshe_0-1647331966642.png

the expression of the column is

sum( aggr( sum({<Is_Monitor_Active={1},[current_Month?]={0},Customer_Name=,Year={'$(vSelectYear)'}>}total <Site_Area,Year,Month> Total_Yield),Site_Area,Month))
/
Sum( aggr(sum ({<Is_Monitor_Active={1},[current_Month?]={0},Customer_Name=,Year={'$(vSelectYear)'}>}total <Site_Area,Year,Month> Site_Size_DC),Site_Area,Month))

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

In a table, you can change the Total Settings for your measure:

Or_0-1647333028338.png

 

In a pivot table, you'll have to refactor your code to allow for totals. You can probably do this by using the Dimensionality() function to find out if you're at row level or (sub)total level and use different formulas for each one:

if(Dimensionality()<1,TotalFormula,LineFormula)

Alternatively, you could rewrite your formula to handle both cases by wrapping the whole thing in e.g. sum(aggr(YourFormula),YourDimension1,YourDimension2), not sure how that'll interact with your already-complex formula insofar as getting the correct data and performance.

View solution in original post

4 Replies
Or
MVP
MVP

In a table, you can change the Total Settings for your measure:

Or_0-1647333028338.png

 

In a pivot table, you'll have to refactor your code to allow for totals. You can probably do this by using the Dimensionality() function to find out if you're at row level or (sub)total level and use different formulas for each one:

if(Dimensionality()<1,TotalFormula,LineFormula)

Alternatively, you could rewrite your formula to handle both cases by wrapping the whole thing in e.g. sum(aggr(YourFormula),YourDimension1,YourDimension2), not sure how that'll interact with your already-complex formula insofar as getting the correct data and performance.

EliranMoshe
Contributor
Contributor
Author

thanks , as you can see i have no option to change the total function

also at the other columns the total is good

 

EliranMoshe_1-1647334935954.png

 

 

 

 

Or
MVP
MVP

As I said, that option is only available for regular tables, and you appear to be using a pivot table. In pivot tables, the total function is always the equivalent of Auto - it will be calculated using the same formula as the lines. You can use one of the approaches in my previous post to work around this.

EliranMoshe
Contributor
Contributor
Author

many thanks . it's work perfectly