1 Reply Latest reply: Aug 7, 2018 8:02 AM by Sunny Talwar RSS

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

    Jasmina Karčić

      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

       

       

       

       

       

       

        • Re: How to make KPI that is sum just of positive values?
          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))