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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing records

Hi All,

I have a requirement where I want  to  count the number of items that are  newly added . I need to compare the items with that of previous Month.

   

Month -YearItemNameItemNo
Jan-15AAA1
Jan-15BBB2
Jan-15CCC3
Feb-15AAA1
Feb-15BBB2
Feb-15DDD4
Mar-15BBB2
Mar-15DDD4
Mar-15EEE5
Mar-15CCC3

I want to show in straight table as below

  

Month-YearNewlyAddedItems
Jan-150
Feb-151
Mar-152

Help on this ..

Thanks

2 Replies
maxgro
MVP
MVP

1.png

source:

load *, date(date#(MonthYear, 'MMM-YY')) as Date inline [

MonthYear ItemName ItemNo

Jan-15 AAA 1

Jan-15 BBB 2

Jan-15 CCC 3

Feb-15 AAA 1

Feb-15 BBB 2

Feb-15 DDD 4

Mar-15 BBB 2

Mar-15 DDD 4

Mar-15 EEE 5

Mar-15 CCC 3

] (delimiter is spaces);

load Date(min(Date)) as MinDate Resident source;

let vMinDate=Peek('MinDate');

Left Join (source)

load

  ItemName, ItemNo, Date,

  if(  Peek('ItemNo')=ItemNo and Peek('Date')=AddMonths(Date, -1) or Date='$(vMinDate)' , 'Exists', 'New') as FlagExists

Resident source

Order by ItemNo, Date;

Final:

load MonthYear, sum(if(FlagExists='New',1,0)) as New

Resident source

group by MonthYear;

Not applicable
Author

Hi MG,

Thanks for the solution but I need to do this in Chart level without changing in the script. How this could be done in chart?

Thanks