Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
jasmina_karcic
Contributor II

How to make KPI that is sum just of positive values?

Hi experts,

I need your help in writing an expression.

I have:

MEASURE:

round(

fabs(

Sum({$<DATE={"$(=date(rangemin(today()-2,MAX(DATE)-1)))"},  DIM={"6", "22"}>}VALUE)

)

-

fabs(

Sum({$<DATE={"$(=date(rangemin(today()-1,MAX(DATE))))"},  DIM={"6", "22"}>}VALUE)

)

)


This expression works fine, it gives me sum of all differences in values for last 2 days. It works very good in a table, where a have:

CLIENT                       MEASURE

A                                  100 000

B                                    30 000

C                                      5 000

....

I sorted numerically asc, and took fixed number option, and top 10 values.

In table this is okay.

But how to take sum of 10 biggest results of this measure in KPI?

Thanks

Regards,

Jasmina

Tags (2)
1 Reply

Re: How to make KPI that is sum just of positive values?

May be this

Sum(Aggr(

If(Rank(

(Round(fabs(Sum({$<DATE={"$(=date(rangemin(today()-2,MAX(DATE)-1)))"},  DIM={"6", "22"}>}VALUE))-

            fabs(Sum({$<DATE={"$(=date(rangemin(today()-1,MAX(DATE))))"},  DIM={"6", "22"}>}VALUE)))) < 11,

(Round(fabs(Sum({$<DATE={"$(=date(rangemin(today()-2,MAX(DATE)-1)))"},  DIM={"6", "22"}>}VALUE))-

            fabs(Sum({$<DATE={"$(=date(rangemin(today()-1,MAX(DATE))))"},  DIM={"6", "22"}>}VALUE)))

, CLIENT))