Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

manigunta
Contributor

count of active months

Hi,

With below expression, we are able to get sum of value which we have in 18months. How can we get count of the months


Sum({<Date = {"$(='>=' & Date(AddMonths(Max(Date), -24)) & '<=' & Date(AddMonths(Max(Date), -6)))"}>}Value)


For example, i will be having data as 100 in last 12 months, this does not mean as in all last 12 months i have data.

how can i get months and count of months in which i have data.


Can anyone please suggest on this

1 Solution

Accepted Solutions
YoussefBelloum
Esteemed Contributor

Re: count of  active months

NO, on the app I send to you above, the expression used is this one :

=Count({<data1={"=len(trim(data1))<>0"}>}date)

24 Replies
YoussefBelloum
Esteemed Contributor

Re: count of active months

Hi,

add this on your set analysis:

Value={"=len(trim(Value))<>0"}

manigunta
Contributor

Re: count of active months

this is to get value  greater than zero right, how i can get months related to greater than zero value as my request

For example, i will be having data as 100 in last 12 months, this does not mean as in all last 12 months i have data.

how can i get months and count of months in which i have data.


Can anyone please suggest on this

krishna_2644
Valued Contributor III

Re: count of active months

in set expression ,try something like this:

months =" $(= p( Value={"=len(trim(Value))<>0"}) months )"

YoussefBelloum
Esteemed Contributor

Re: count of  active months

the solution I gave you is when you don't have data at all on a month with the measure Value (using month as dimension).

like this, as u said, it will not count the "non active" months.

did you try it ?

agigliotti
Honored Contributor II

Re: count of active months

maybe this:

Count( {< Date = {"$(='>=' & Date(AddMonths(Max(Date), -24)) & '<=' & Date(AddMonths(Max(Date), -6)))"} >} Distinct your_month_field )

manigunta
Contributor

Re: count of  active months

i tried using this, but no luck.


i am using correctly as you mentioned

Sum({<Date = {"$(='>=' & Date(AddMonths(Max(Date), -24)) & '<=' & Date(AddMonths(Max(Date), -6)))"}>}{"=len(trim(Value))<>0"})

manigunta
Contributor

Re: count of  active months

i tried using this, but no luck.


am i using correctly as you mentioned

Sum({<Date = {"$(='>=' & Date(AddMonths(Max(Date), -24)) & '<=' & Date(AddMonths(Max(Date), -6)))"}>}{"=len(trim(Value))<>0"})

agigliotti
Honored Contributor II

Re: count of active months

please add the below in set analysis:

your_month_field = {"=Sum(Value)>0"}

YoussefBelloum
Esteemed Contributor

Re: count of active months

it is not correctly written..

try like this:

Sum({<Date = {"$(='>=' & Date(AddMonths(Max(Date), -24)) & '<=' & Date(AddMonths(Max(Date), -6)))"},Value={"=len(trim(Value))<>0"}>} Value)



Community Browser