Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Product | Year | January | Februari | March.. etc. |
---|---|---|---|---|
ABC123 | 2011 | 5 | 2 | ... |
2012 | 6 | 3 | ... | |
2013 | 7 | 4 | ... | |
Average | 6 | 3 | ... | |
ABC124 | 2011 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?
You can use condition count(total Year). If it is 1, just show nothing (blank text), otherwise your expression as is.
You can use condition count(total Year). If it is 1, just show nothing (blank text), otherwise your expression as is.
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
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>
)
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