Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Count general values and selected values

Hello,

I need to develop a routine which will count general values of a such interval of time, if no month is selected, and if one month is selected, must count all the values of the selected month.

At this time, I have the routine below:

=IF(ISNULL(GetFieldSelections(name_month))=-1,

    Count({$<dataMonth={$(#=Num((Month(AddMonths(Today(), -1)))))}, [SomeField]={"Q"}>}[SomeField]),

    Count({1<dataMonth={$(#=dataMonth1)}, [SomeField]={"Q"}>}[SomeField])

    )

Additionally, I will need to match values of the past year, if the selected month is january or february. How can I match that?

I've tried something like:

IF(GetFieldSelections(name_month)='jan' OR GetFieldSelections(name_month)='fev',

        Count({$<dataMonth={$(#=Num(Month(Today())))}, dataYear={$(#dataYear-1)}, [SomeField]={"Q"}>}[SomeField]),

        Count({1<dataMonth={$(#=dataMonth)}, dataYear={$(#dataYear-1)}, [SomeField]={"Q"}>}[SomeField])

    )

Can anyone help me in this?

2 Replies
chauhans85
Esteemed Contributor

Count general values and selected values

getselectedcount to count selected value where as

count(fieldname) to count genral valie

or

count({$} fieldname) for selected value and count({1-$} fieldname) to unselected value

geminihzh
Valued Contributor

Re: Count general values and selected values

As searching for "count selected value" and this answer comes out the first few solution, think it is better to provide the correct solution here.

The correct expression for the selected value is as below:

=GetSelectedCount(fieldname)

The count({$}filename) does not work if there is no selection yet, it will return the number of all value.


Zhihong

Community Browser