Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to calculate percentage on Totals.

Hi all,

I Need to Calculate the percentage of each column on the totals of each rows.

In other words, I show you the table :

esempio.png

I'd like to obtain, for each rows, this value:

TotalsColumn1Column2Column3Column4
30/12/2014552.687.882478.734.685 / 552.687.88228.035.992 / 552.687.882
44.026.805 / 552.687.882
1.890.400 / 552.687.882
31/03/2015747.808.949676.981.625 / 747.808.949and so on....

To obtain this, I've tried with set analysis to ignore the dimension column in this way:

Count([Misure1]) / Count({$<dimension= >}[Misure1])

But it doesn't work. Can  someone help me?

6 Replies

Re: How to calculate percentage on Totals.

Try this:

Count([Misure1]) / Count({$<dimension= >} TOTAL <Data> [Misure1])

Not applicable

Re: How to calculate percentage on Totals.

Thank you Sunny for the response, but in this way it returns all zero value

Re: How to calculate percentage on Totals.

Would you be able to share a sample where this isn't working for you?

Not applicable

Re: How to calculate percentage on Totals.

Yes, I can show you my specific situation:

I have a "Radio Button element" (bi-era.com-listbox is the name of the extension) that allows me to select a list of dimensions. The table has two dimensions: Data and Dim1 that is a varaiable and changes depending on the item selection.

I attached an image that shows the table and the Radio Box Element:

Example-QS.png

In the table properties, in added

  • "Data" in "Rows" section,
  • "Dim1" in "Columns" section with this expression    $(='[' & only(Dim1) & ']')  because It's possible to change the dimension analysis by the Radio Button element
  • And I added a misure too.

Dim1 is so defined:

Load * Inline [

     Display, Dim1

     'Dimension X','xxx'

     'Dimension Y','yyy'

     'Dimension W', 'www'

];

So, I tried to write the expression that you suggested, in this way:

Count([Misure1]) / Count( {$<  $(='[' & only(Dim1) & ']')=  >} TOTAL <Data> [Misure1])

But it doesn't work, and i'm not sure the code is written in the right way.

Can you help me?

Re: How to calculate percentage on Totals.

You want to see the percentage as this, right?

458,228,652

/

527,815,510

If this is what you want, I am not sure why it doesn't work. May be you are looking for this (but not sure)

Count([Misure1]) / Count(TOTAL <$(='[' & only(Dim1) & ']')> [Misure1])

dixit_panchal1
New Contributor III

Re: How to calculate percentage on Totals.

Try this:

num(Count([Misure1]) / Count({$<dimension= >}[Misure1]) ,'#,##0%')


Regards,

Dixit Panchal

Community Browser