Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare TOTAL and ALL function in sum expressions

Hi,

i have a file.qvw with two columns, TMP_ALL e TMP_TOTAL. If i make no selections it's all ok (value of the two columns are the same), if i filter by Data, Regione, ecc... the values of the columns are different (because the expression defined into TMP_TOTAL depends from the selection). Is there a way to have the same results on the two columns regardless of the filters applied?

See the attachment.

Thank you

1 Solution

Accepted Solutions
rubenmarin

Hi giuseppe, if you want to ignero selection in Provincia field you'll need to especify the fields you want to ignore:

count(Provincia)/count(TOTAL {<Provincia>} Provincia) <-- This will ignore selections in Provincia for the denominator but applies all other selections

View solution in original post

4 Replies
MK_QSL
MVP
MVP

sum({1}TOTAL<Data> Popolazione)

Not applicable
Author

!Sorry, the example i posted wasn't good. I created a new project where i have 14 cars, all registered on 01/01/2010 and sold from 01/02/2010 to 01/03/2011 (one for month). The 14 cars are distributed on 2 Province: 8 for Milano and 6 for Brescia. If I make no selections i have 6/14=42.86% for Brescia and 8/14=57.14% for Milano; if I select cars sold from 01/07/2010 to 01/03/2011 (9 cars, 5 for Brescia and 4 for Milano) I obtain the following % of distribution:


Brescia: 5/9=55.56%

Milano: 4/9=44.44%


If I add another Selection (Brescia) the % of distribution is 100% (the value is correct because depends by the second filter but I'd like mantain 55.56%, namely the % respect the 9 cars obtained filtering only for date of sale).

Is there a way to make this (block the denominator to the value calculated independently from the second filter)?

The solution {1}TOTAL is not good because the distibution is calculated over all cars(14).

rubenmarin

Hi giuseppe, if you want to ignero selection in Provincia field you'll need to especify the fields you want to ignore:

count(Provincia)/count(TOTAL {<Provincia>} Provincia) <-- This will ignore selections in Provincia for the denominator but applies all other selections

Not applicable
Author

Thank you so much Ruben, it works!!!