Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Saro_2306
Contributor II
Contributor II

Current Month minus last month

Hi All,

I need to show new task added, by month selection of month.  i.e (refer below table.) below are allotted headcount list for respective task.   On Jan Month Task 3 newly added, Feb month Task 4, May Month Task 1 & 2 

when selecting Month Jan my Pivot table should show Only Task 3, if selection is May month it should be Task 1 & 2

TaskDec-19Jan-20Feb-20Mar-20Apr-20May-20Jun-20Jul-20Aug-20Sep-20
Task 10.000.000.000.000.003.003.003.003.003.00
Task 20.000.000.000.000.006.006.006.006.006.00
Task 30.007.007.007.007.007.007.007.007.007.00
Task 40.000.003.003.003.003.003.003.003.003.00
Task 50.000.000.000.000.000.000.000.004.004.00

 

I used formula - if(sum({<Months ={$(=Max(Months))}>}Headcount) >'0.00' and sum({<Months ={$(=Max(Months)-1)}>}Headcount)='0.00', sum(Headcount),0)  then I used 'suppress null' option. but all values shows zero and no task displayed. can somebody help me to rewrite formula 

1 Solution

Accepted Solutions
MayilVahanan

HI @Saro_2306 

Try like below

Temp:
CrossTable(Month, TaskCount)
LOAD * INLINE [
Task, Dec-19, Jan-20, Feb-20, Mar-20, Apr-20, May-20, Jun-20, Jul-20, Aug-20, Sep-20
Task 1, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
Task 2, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6
Task 3, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7
Task 4, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3
Task 5, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4
];

Final:
Load *, If(Previous(TaskCount)=0 and TaskCount > 0, 1, 0) as Flag Resident Temp
order by Task;

DROP Table Temp;

Dim: Task & Month

Exp: Sum({<Flag={1}>}TaskCount)

O/P:

MayilVahanan_0-1617178824886.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI @Saro_2306 

Try like below

Temp:
CrossTable(Month, TaskCount)
LOAD * INLINE [
Task, Dec-19, Jan-20, Feb-20, Mar-20, Apr-20, May-20, Jun-20, Jul-20, Aug-20, Sep-20
Task 1, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3
Task 2, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6
Task 3, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7
Task 4, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3
Task 5, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4
];

Final:
Load *, If(Previous(TaskCount)=0 and TaskCount > 0, 1, 0) as Flag Resident Temp
order by Task;

DROP Table Temp;

Dim: Task & Month

Exp: Sum({<Flag={1}>}TaskCount)

O/P:

MayilVahanan_0-1617178824886.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Saro_2306
Contributor II
Contributor II
Author

Thanks a lot. It working fine.