Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Column Percentage

I'm sure I'm writing wrong this formula

=Sum({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento])/sum (total({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento]))

I need to calculate the column percentage...how should it be written the formula? My problem is that this variable [Codice Documento] must respect those values {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}....

thanks to everyone!

Tags (1)
1 Solution

Accepted Solutions
lironbaram
Honored Contributor II

Re: Column Percentage

hi

you need to put the total after the set analysis part

your Expression should look like this:

=Sum({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento])/sum ({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} TOTAL  [QTA 1 Documento])

13 Replies
Employee
Employee

Re: Column Percentage

It looks correct.

Make a simple test:

1) add this expression

Sum( [QTA 1 Documento])/sum (total [QTA 1 Documento])

2) Add a listbox to [Codice Documento] and select 'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI' using control-click


Is this value correct?

lironbaram
Honored Contributor II

Re: Column Percentage

hi

you need to put the total after the set analysis part

your Expression should look like this:

=Sum({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento])/sum ({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} TOTAL  [QTA 1 Documento])

Not applicable

Re: Column Percentage

I know that I can do it in that way, but I'm forced to put that set of values within...I cannot filter those values otherwise other dimension values' change...

Employee
Employee

Re: Column Percentage

No,

=sum( {<Dim1={"A"}>} total Expression1) and

=sum(total  {<Dim1={"A"}>} Expression1) returns same value

Not applicable

Re: Column Percentage

thank you soooo much Liron Bra'am!!!

Employee
Employee

Re: Column Percentage

It was just a test

Is this expression into same app, right?

Guide me to find where you are using this expression

Not applicable

Re: Column Percentage

I must added that formula in the chart "Riepilogo ENTRATE" and "Riepilogo USCITE". Your solutions was correct, the point is that I needed to embody [Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'} within the formula...

MVP
MVP

Re: Column Percentage

The issue is probably due to the use of additional round brackets after total, try removing them:

=Sum({<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento])/sum (total {<[Codice Documento]= {'CLI-SCONTRINO','NEG-FATIMM','FOR-DDTRESO','INT-BUONOSCA','SCA-DANN-FURTI'}>} [QTA 1 Documento] )

Not applicable

Re: Column Percentage

it says that there is an error in the expression...it doesn't work...

Community Browser