Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
swarup_malli
Specialist
Specialist

Totals don't match ?After adding up values of individuals selections.

Hi,

I have a table.

The totals are incorrect.

example

1) I select a value F10 from the list box,the chart gives a value of 1,708 (see fig 1) for Jan 2014

f10.png

2) I select a value F20  from the list box,the chart gives a value of 2,746 (see fig 1) for Jan 2014

f20.png

3) On selecting both F10 and F20 I get wrong results , the value should have been 4,452 instead of 3,531

both.png

I'm using the following formula in the expression:


(Sum ({<ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>}AVG_HRS_PM_FLIGHT)
/ COUNT({< ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>} AC_SERIAL)
* COUNT({<ROLLING_FLAG={1}>}AC_SERIAL))


Why is the expression behaving strangely?

SM

1 Solution

Accepted Solutions
swarup_malli
Specialist
Specialist
Author

Fixed it by using the Aggr function


SUM(
     AGGR(

(Sum ({<ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>}AVG_HRS_PM_FLIGHT)
/ COUNT({< ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>} AC_SERIAL)
* COUNT({<ROLLING_FLAG={1}>}AC_SERIAL)),


MY_DIMENSIONS))


View solution in original post

2 Replies
swarup_malli
Specialist
Specialist
Author

Fixed it by using the Aggr function


SUM(
     AGGR(

(Sum ({<ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>}AVG_HRS_PM_FLIGHT)
/ COUNT({< ROLLING_FLAG={1},  AEXISTS={'Y'}, E_FLAG={'Y'}>} AC_SERIAL)
* COUNT({<ROLLING_FLAG={1}>}AC_SERIAL)),


MY_DIMENSIONS))


rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

My guess is that some values belong to both F10 and F20? Counting them only once is correct QV behavior. If instead you want the "sum of rows", you can get that with an aggr() as you have done.

-Rob