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

status on the basis of last & current month data

HI All,

I am facing an issue in calculating certain field

All the Id's has different status for each month ,we need to calculate new status which will be calculated on the basis of status of Id comparison with its last month status

if  current month status is  A and   last month status is B - then UP is my Status New

if  A-B - then UP
if B-C then UP
if A-C then UP
if C-A then DOWN
if B-A then DOWN
if B-A then UP
if C-B then DOWN

Please find the sample file

8 Replies
tresesco
MVP
MVP

May be like this?

If(RowNo()=1,'NA', If(Peek(Status)<Status, 'UP', 'DOWN')) as "New Status"

kevinchevrier
Partner - Creator III
Partner - Creator III

May be something like this in your script :

If(PREVIOUS(Status) = 'A', If(Status= 'B' or Status = 'C', 'UP'),

If(PREVIOUS(Status) = 'B', If(Statuts = 'A', 'DOWN', if(Statuts = 'C', 'UP')),

If(PREVIOUS(Status) = 'C', If(Statuts = 'A' or Status = 'B', 'DOWN')) as "New Status"


or :

If(pick(previous(Status),1,2,3)>pick(Status,1,2,3),'DOWN','UP') as "New Status"

kevinchevrier
Partner - Creator III
Partner - Creator III

Else Tresesco B is right.

I made your table in the file attached. Is it ok ?

Anonymous
Not applicable
Author

Hi Tresesco ,

Thanks for your reply . I am facing an issue while implementing your logic in my real scenario .So I am sharing you the sample file of my real scenario .Please help me out to implement the same

Anonymous
Not applicable
Author

Also need to count ID's with 'UP'  as New Status

Anonymous
Not applicable
Author

Thanks for your reply .I have add my  real scenario .Do you have any idea

mahendragaur
Creator
Creator

Hello Shweta,

Please find the attached file. I think this is what you were expecting.

Anonymous
Not applicable
Author

Can we implement the same using  applymap