Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
RyugaHideki
Contributor III
Contributor III

Sum of current column

Greetings 

I'm trying to calculate the percentages based on the current column/dimensionality 

table is like this

RyugaHideki_0-1730189213500.png

the Counts i got from crossing are correct but i want to for example the percentage of '18 ans - 24 ans' would be 11/65 which is the sum of that column in that dimensionality with that crossing betwen Center/ marque/trancheAge , i'm not sure if i made the point clear or not and the same thing would be for 'IFRUIT' it would be 65/ the sum of the rest of the column, 
thank you for guiding me and helping in advance 

Labels (2)
6 Replies
Kushal_Chawda

@RyugaHideki  Let's say your expression is "sum(Value)" then your % expression will become below

=sum(Value)/sum(total <Regions,Marques>Value)
RyugaHideki
Contributor III
Contributor III
Author

that would not help with crossing if you're trying to change the dimensions order it would always show regions as 100%

if it helps the numbers are obtained by crossing those dimensions at a certain table since they're linked by Num or ID 

Count({<TABLE={'A'}>} Num) 

A is just an indicator of that table 

there is a way of Counting at the data loader level of every possible crossing but when the data is massive it's not an optimal solution and displaying would be reliant on many conditions 

Kushal_Chawda

@RyugaHideki  You can adjust it using GetObjectField(). In case any dimension are changing dynamically you will not get any issues. Where GetObjectField(0) = first Row dimension and GetObjectField(2)= 1st column dimension.  You can adjust it according to your need

 

Count({<TABLE={'A'}>} Num) /Count(total <[$(=GetObjectField(0))],[$(=GetObjectField(2))]>{<TABLE={'A'}>}Num)

 

 

RyugaHideki
Contributor III
Contributor III
Author

i've done that approach before it's inconsistent 

it shows 100% on the parent rows 

RyugaHideki_0-1730202748766.png

 

 

Kushal_Chawda

@RyugaHideki  try below

=if( Dimensionality()=1,
Count({<TABLE={'A'}>} Num) /Count(total <$(=GetObjectField(2))]>{<TABLE={'A'}>}Num),
Count({<TABLE={'A'}>} Num) /Count(total <[$(=GetObjectField(0))],[$(=GetObjectField(2))]>{<TABLE={'A'}>}Num))
RyugaHideki
Contributor III
Contributor III
Author

sorry for the late reply as i had to perform some tests and what you're trying to do essentially there is calculating based on the parent dimension which is something i've already done it's a nice approach but for example if you select one dimension it'll show 100% (an easy fix for that is remove 

$(=GetObjectField(2))

 in dimensionality=1 condition but anyway what i'm trying to achieve is shown in these pictures

RyugaHideki_0-1730273302181.png

RyugaHideki_1-1730273323447.png

notice how the results change for the region by changing the dimension position i'm trying to have fixed results