Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimensionality() Function: Hide Partial Sum

Hello, I am using the following code to calculate the average instead of the normal sum:

if(Dimensionality()=0, sum([MutationValue])*-1, sum([MutationValue])*-1/count(distinct [CalendarYear]))

This works great, and shows the table as follows:

ProductYearJanuaryFebruariMarch.. etc.
ABC123201152...
201263...
201374...
Average63...
ABC1242011 etc..........

However, when selecting one year, I would like to remove the average all together. Since only one year is selected, it makes no sense to keep the average. How could I accomplish this?

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You can use condition count(total Year).  If it is 1, just show nothing (blank text), otherwise your expression as is.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

You can use condition count(total Year).  If it is 1, just show nothing (blank text), otherwise your expression as is.

Not applicable
Author

When I use this condition something strange happens.For some reason it works the other way around. When I see 2 or more years in the table, the partial sum is hidden. When I select 1 year however, the partial sum is shown.

if(Dimensionality()=0,

       sum([Mutation]),

       if(Count(Distinct [Year]) = 1,

            sum([Mutation])/count(distinct [Year]),

  0))

How can I invert this? If I do like this, the years all dissappear:

if(Dimensionality()=0,

       sum([Mutation]),

       if(Count(Distinct [Year]) = 1, 0,

            sum([Mutation])/count(distinct [Year])))



--------------------------------------------------------------

I found a solution myself. change dimensionality() to dimensionality() = 2.

For some reason this works

Anonymous
Not applicable
Author

Dimensionality value to check depends on your table structure...

It works -great.  But I meant something a little simpler:

if(Count(Distinct Year) = 1, ' ',

<your original expression>

)

Not applicable
Author

hello willem daaw,i am naveen i am new to qlikview ,in a interview i was asked about this kind of scenario,

i have three countries sales ,by using pivot chart we should display only two countries  names but the total has to be sum of all the three countries sales,

so how could i can achieve these ,do we need to use dimensionality ()=0 kind of function to get total sales ,

actually what does dimensionality()=0 means

thanks in advance