Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Do More with Qlik - for Beginners and Beyond, Topic: Qlik Replicate on January 21, 2PM EST. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
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.

1 Solution

Accepted Solutions
MVP
MVP

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

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

Contributor II
Contributor II

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

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

=Count(Distinct StateCode)

Contributor II
Contributor II

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....