Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
juanjulian_hs
Contributor II
Contributor II

Set analysis date with count function

Hello everyone,

I have built a KPI with the  "likelihood to recommend" value for any selected month.

I am now trying to incorporate within the same KPI  the previous month  "likelihood to recommend"  value. However, I am running into problems.

For my current KPI I have the following set analysis:

num(Count({<LIKELIHOOD_TO_RECOMEND_TEXT={"Promoter"}>}LIKELIHOOD_TO_RECOMEND_TEXT)-Count({<LIKELIHOOD_TO_RECOMEND_TEXT={"Detractor"}>}LIKELIHOOD_TO_RECOMEND_TEXT))

/num(Count(LIKELIHOOD_TO_RECOMEND_TEXT))*100

For my previous month KPI I have tried the following two set analysis both without luck:

1)

num(Count({$1}{<LIKELIHOOD_TO_RECOMEND_TEXT={"Promoter"}>}LIKELIHOOD_TO_RECOMEND_TEXT)-Count{$1}({<LIKELIHOOD_TO_RECOMEND_TEXT={"Detractor"}>}LIKELIHOOD_TO_RECOMEND_TEXT))

/num(Count({$1}LIKELIHOOD_TO_RECOMEND_TEXT))*100

2)

Sum({<MonthYear{'=$(vMaxPreviousMonthYear)'}>}num(Count({<LIKELIHOOD_TO_RECOMEND_TEXT={"Promoter"}>}LIKELIHOOD_TO_RECOMEND_TEXT)-Count({<LIKELIHOOD_TO_RECOMEND_TEXT={"Detractor"}>}LIKELIHOOD_TO_RECOMEND_TEXT))/num(Count(LIKELIHOOD_TO_RECOMEND_TEXT))*100)

If anyone knows the right way to tackle this issue I will greatly appreciate it. Promoters and detractors are matched in the back end with its corresponding numbers.

Thank you all!

1 Solution

Accepted Solutions
kfoudhaily
Creator III
Creator III

=

(

num(

     Count(

               {<

               MonthYear{"=$(vMaxPreviousMonthYear)"},

               LIKELIHOOD_TO_RECOMEND_TEXT={'Promoter'}

               >}

               LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

-

num(

     Count(

               {<

               MonthYear{"=$(vMaxPreviousMonthYear)"},

               LIKELIHOOD_TO_RECOMEND_TEXT={"Detractor"}

               >}

               LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

/

num(

     Count(

     {<

     MonthYear{"=$(vMaxPreviousMonthYear)"}    //percentage should be calculated considering global total or previous month too?

     >}

     LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

)

*100

QlikView Qlik Sense consultant

View solution in original post

2 Replies
kfoudhaily
Creator III
Creator III

=

(

num(

     Count(

               {<

               MonthYear{"=$(vMaxPreviousMonthYear)"},

               LIKELIHOOD_TO_RECOMEND_TEXT={'Promoter'}

               >}

               LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

-

num(

     Count(

               {<

               MonthYear{"=$(vMaxPreviousMonthYear)"},

               LIKELIHOOD_TO_RECOMEND_TEXT={"Detractor"}

               >}

               LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

/

num(

     Count(

     {<

     MonthYear{"=$(vMaxPreviousMonthYear)"}    //percentage should be calculated considering global total or previous month too?

     >}

     LIKELIHOOD_TO_RECOMEND_TEXT

               )

     )

)

*100

QlikView Qlik Sense consultant
juanjulian_hs
Contributor II
Contributor II
Author

Thanks a lot!!

I only had to add an equal sign at the beginning of every MonthYear and it worked!

  {<

               MonthYear = {"=$(vMaxPreviousMonthYear)"},