Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

homersimpson
Contributor II

Add Up count values

Hi,

i want to add up count values. I try it like this, but it doesn´t work:

Count({<[prodYear] = {"$(=getfieldselections(Year))"},[prodMonth] = {"Nov"}>}products) + Count({<[prodYear] = {"$(=getfieldselections(Year))"},prodMonth = {"Okt"}>}products)

The dimension in this chart is prodMonth.

My target is to add up allways the number of products for the last three month.

In Sep i want the sum of products for Jul, Aug, Sep

In Okt i want the sum of products for  Aug, Sep, Okt

etc.

How can i do it?

regards,

sam

1 Solution

Accepted Solutions
MVP
MVP

Re: Add Up count values

My bad, forgot to end the set analysis correctly

RangeSum(Above(Count({<[prodYear] = p(Year)>} products), 0, 3))

10 Replies
MVP
MVP

Re: Add Up count values

May be try like this:

RangeSum(Above(Count({<[prodYear] = p(Year)>} products), 0, 3))

MVP
MVP

Re: Add Up count values

or this if your months are sorted in descending order

RangeSum(Below(Count({<[prodYear] = p(Year)>} products), 0, 3))

homersimpson
Contributor II

Re: Add Up count values

Thanks. The chart shows no data. There are no expression errors in the editor. Is missing a comma or something? I can´t find the reason.

MVP
MVP

Re: Add Up count values

My bad, forgot to end the set analysis correctly

RangeSum(Above(Count({<[prodYear] = p(Year)>} products), 0, 3))

homersimpson
Contributor II

Re: Add Up count values

Perfect, now it works, thanks a lot :-)

The chart shows always numbers like 30,23k and i want to see the normal number like 30230. So i put this expression in a textfield to see the normal number only for "nov" (sum for sep,okt,nov). But this expression shows 0

RangeSum(Above(Count({<[prodYear] = p(Year), prodMonth = {"Nov"}>} products), 0, 3))


What´s wrong and how can the chart show normal numbers?


regards,

sam

MVP
MVP

Re: Add Up count values

I guess change your number formatting from here:

Capture.PNG

homersimpson
Contributor II

Re: Add Up count values

Yes, very easy. I just looked for it and did not find it, but now, thanks one more time again

MVP
MVP

Re: Add Up count values

I am glad we were able to figure it out

homersimpson
Contributor II

Re: Add Up count values

Hi,

i check the data and the sum for each month does not match those of the excel table

My target is to add up allways the number of products for the last three month.

In Sep i want the sum of products for Jul, Aug, Sep

In Okt i want the sum of products for  Aug, Sep, Okt

etc.

I use your expression and added "distinct"

RangeSum(Above(Count(Distinct{<[prodYear] = p(Year)>} products), 0, 3))

I create a table, select a month in the chart and check the table of double products. There are double products.

Why? Is "Distinct" wrong in this case or at a wrong position?

regards,

sam