Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

movement of population

Hi, i've made this table that shows the movement of the population of a client company in between two months

emp  cust_id         apr-11      mar-11

3011      89               1             0

3011      90                1             0

3011      91                1             0

3011      92                0             1

3011      93                0             1

3011       94                 1           1

this indicates that there are three people who are in apr11 and not in mar11 , there are two people who are not in apr11 but they were in mar11 and a person who is in mar11 and apr11

now i need to do this:

situation  apr11 vs mar11

emp      mov                      count

3011     IN                              3

3011      OUT                         2

3011    NO MOVE                 1                             

Is it possible? anybody can help me?

Thanks in Advance

1 Solution

Accepted Solutions
Not applicable
Author

Hi Mario,

try this in the script:

num(MONTH(YM)) AS MonthC,

Sometimes in set analysis u have some problem with this thing.

It's better use month as number.

C u,

Stefano.

View solution in original post

11 Replies
Not applicable
Author

Hi,

Mario, try this attach.

(now maybe u are sleeping... )

Ciao/Buona notte,

Stefano.

Not applicable
Author

Ciao Stefano! That's right, I was sleeping when you answered

First of all thank you very much, I'm seeing the solution and admired since I can hardly understand the set_analysis at all, but my problem now is that the excel 'll sent is extracted from a table of my QV, so the preparation of 1 and 0 is through formulas.

On Apr-11 the formula is:

count (CUST_ID)

Mar-11 the formula is:

COUNT(

    {$<YearC= {$(=getfieldselections(Year, ','))}, MonthC= {$(=getfieldselections(Month, ','))}, Year = , Month = >}

CUST_ID)


I thought maybe i can use aggregation functions, but I have no idea how to implement it

Not applicable
Author

Hi Mario,

in this case maybe set_analysis can't work fine....

U should use some function like "above" or "before" or something similar if u know in a pivot table...

It's difficult create an example in this way.. may u give me a file with that table, so i can look that?

Stefano.

Not applicable
Author

Try this..

i hope it is useful and u can adapt this at your case

Stefano

Not applicable
Author

Ciao Stefano, today I had a busy day and could not work on this issue, as you say it is difficult to see with this example. The next week will try to prepare a small qv to show you.

Thanks and wish you a very good weekend

Not applicable
Author

Hi Mario,

try this file, maybe u can adapt this to your case.

Stefano.

Not applicable
Author

Ciao Stefano, this is a brief example of my application

Thank You!

Mario

Not applicable
Author

Hi Mario,

let me know if this is ok.

I believe that the numbers are correct but verify by yourself..

C u,

Stefano

Not applicable
Author

Ciao Stefano, I'm sorry that I have not responded before. I tried your example but when i copied the "table" in my QV, only works the column "IN", i cant realize why!

As always, thank you very much!