Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sampusala
New Contributor II

Not working as expected when I use normal count and set analysis count in if condition

Using below logic.

By default it should calculate last Quarter for all the years which looks fine for me, but when I select Year and Quarter Q1 I am getting Jan, Feb, Mar, Apr, May, Jun as below image instead Jan, Feb, Mar. Here I am using pivot chart with time drill Year-->Quarter.

if(GetSelectedCount(Year)>=1 or GetSelectedCount(Quarter)>=1, 

count(TimeSpent),

count({<Quarter={$(vLastQuarter)}>}TimeSpent))

It looks it is simple but I feel I am missing something.

For my testing count(TimeSpent) is working as expected, issue is when try to show defaults for last Quarter with the above logic.

appreciate for your help.

Not Ok if I select current Quarter:

img1.PNG

Ok if I select last Quarter  with the above if condition or simple count(TimeSpent).

img2.PNG

2 Replies
arvind_patil
Valued Contributor II

Re: Not working as expected when I use normal count and set analysis count in if condition

Hi Sam,

Please  try below Expression:

count({<Quarter={'$(=maxString(Quarter))'}>}TimeSpent))


Thanks,

Arvind Patil

agigliotti
Honored Contributor II

Re: Not working as expected when I use normal count and set analysis count in if condition

first of all check your variable vLastQuarter content using a textbox.