Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone. I have a problem with QlikView.
I need to use the same calculations in different objects of my document, so I created some variables containing the code that I need. But when I use these variables as expressions if I aggregate data the fields are not calculated properly.
Both the field "Expr. 1" and "Expr. 3" works well if the table shows the maximum detail but when compressed it shows the value" - ".
Both expressions should, when aggregated, show average value.
Any ideas or suggestions?
Thanks, Capetto
Hello Capetto,
seems to me that you are speaking italien, so I would say regarding your expressions: Madonna !
But let's be serious. In your expr1 and expr3 I can find if()-Statements like "If(CODICE_INDICATORE='XC3W01' OR CODICE_INDICATORE='YC3W01' OR CODICE_INDICATORE='XC3W03' OR CODICE_INDICATORE='YC3W03',.... ". This says the expression works fine if(!) it fits to the filter. This is true for every single line when you don't compress. When you compress the first dimension then "CODICE_INDICATORE" has NO single value (or all values are filtered) and therefor your filter "fails". It's not so easy for me to explain it in english, but try the following instead of your second expression. I am sure you can guess what I mean.
Avg(If(CODICE_INDICATORE='XC3W01' OR CODICE_INDICATORE='YC3W01' OR CODICE_INDICATORE='XC3W03' OR CODICE_INDICATORE='YC3W03', DETTAGLIO_INDICATORI.PUNTEGGIO_ATTESO))
Regards, Roland
I added your expression to the table and I see that it works as I want and that is even collapse the table, only rows that have values, are averaged.
Even my "Expr. 1" contains, as your references to the data lines (if (codice_indicatore =....)) but is not calculated the correct value when the table is compressed because there is no aggregate function instead your expression but did not know where to put it.
If you look at the new example you will see that the "NUMERATORE" field while filtering conditions works fine even if the aggregate (because I added the function in the variable).
Sorry for my bad English but you've already figured out that I'm Italian;)
Thanks, Capetto
Hello Capetto,
Well, don't worry about your english. I do not want to hear the laughter from native english people about my german-english.
With your new additional post I suggest the "DETTAGLIO_INDICATORI.VALORE_ATTESO". I added it to the chart as a new expression and --> when compressing the first dim it is undefined, because it is not within an aggregate. The reason is likely as I posted above. You divide in your expression by it and if you compress the first dim, QV has then three values (e.g. 40, 10, 90). So which value to use now? So try to put it into the aggregate function(s) where meaningful.
RR
I solved my problem adding in the variable VAR_PUNTEGGIO the function avg() and using the function Aggr() in the variable VAR_SCOSTAMENTO.
Now, in the attached example, if you try to expand or collapse the table the "expr. 1" works correctly.
Thank you very much for your support.
Capetto