Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jasmina_karcic
Creator III
Creator III

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

1 Reply
sunny_talwar

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