Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sunny_talwar

Try this:

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

Not applicable
Author

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

sunny_talwar

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

Not applicable
Author

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?

sunny_talwar

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])

Anonymous
Not applicable
Author

Try this:

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


Regards,

Dixit Panchal