Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
sachinryeola
New Contributor II

Help: Count and sum confusion

Hi Guys,

I facing issue in taking count of state.

Please find below expression used in pivote table...

(sum({<Month={$(vMaxMonth)}>}SalesNetValue)-sum({<Month={$(VPrevMonth)}>}SalesNetValue))

/

sum({<Month={$(VPrevMonth)}>}SalesNetValue)

Query: I want display count of states having salesnetvalue (using above expression) below zero.

Tags (2)
1 Solution

Accepted Solutions
MVP
MVP

Re: Help: Count and sum confusion

Your above expression is not returning a sales net value. It's calculating a change percentage of sales net value comparing two months'  aggregated values.

But using this expression and assuming you have a field called State, try an expression search like

Count(

{<

State = {"=

(sum({<Month={$(vMaxMonth)}>}SalesNetValue)-sum({<Month={$(VPrevMonth)}>}SalesNetValue))

/

sum({<Month={$(VPrevMonth)}>}SalesNetValue)

<0"}

>}

DISTINCT State)

View solution in original post

4 Replies
MVP
MVP

Re: Help: Count and sum confusion

Your above expression is not returning a sales net value. It's calculating a change percentage of sales net value comparing two months'  aggregated values.

But using this expression and assuming you have a field called State, try an expression search like

Count(

{<

State = {"=

(sum({<Month={$(vMaxMonth)}>}SalesNetValue)-sum({<Month={$(VPrevMonth)}>}SalesNetValue))

/

sum({<Month={$(VPrevMonth)}>}SalesNetValue)

<0"}

>}

DISTINCT State)

View solution in original post

sachinryeola
New Contributor II

Re: Help: Count and sum confusion

Hi Stefan,

Can you please help me in this query..

I am Using below expression for  Pareto Classes.

Now I want to show count of States falling under each class.

Aggr(

    If(Rangesum(Above(Sum({1} SalesNetValue)/Sum({1} total SalesNetValue),1,RowNo()))<0.8, 'A',

        If(Rangesum(Above(Sum({1} SalesNetValue)/Sum({1} total SalesNetValue),1,RowNo()))<0.9, 'B',

            'C')),

    (StateCode,(=Sum({1} SalesNetValue),Desc))

    )

MVP
MVP

Re: Help: Count and sum confusion

Try the Aggr() function as calculated dimension in a chart and as expression

=Count(Distinct StateCode)

sachinryeola
New Contributor II

Re: Help: Count and sum confusion

Hi Stefan,

It is working fine if I take count for State as in Aggr I have used statecode...

but if I use statecode and distributor code in aggr and then use count of statecode and distributor code then values for statecode are correct but for distributor code it is giving wrong values....