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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Thibo74
Contributor II
Contributor II

Set Analysis Issue : Weekly "Newcomers" count returning only one row in Table/Chart

Hello everyone, 

I'm struggling with a Set Analysis formula to calculate the weekly volume of "Newcomers" in a historical tracking application similar to Jira.

Context : 

I have a snapshot-based data model where each "issue" (identified by issue_id) is recorded every Monday (DD/MM/YYYY) . I want to create a table (or bar chart) showing the volume of "Newcomers" for each week.

Logic : 

A issue_id is considered a "Newcomer" on Week W if : 

  1. It exists in the snapshot of Week W (WeekDate field)
  2. It did not exist in the snapshot of Week W-1 (PreviousWeekDate field)

The problem  : 

When I use the following formula in a table with WeekDate as a dimension, I only get one single row (usually the last week) instead of the full history : 

Count({$
 <WeekDate = P(WeekDate),
 issue_id = E({$ <WeekDate = P(PreviousWeekDate)> })
 >} DISTINCT issue_id)

 

It seems that P(PreviousWeekDate) is calculated globally for the entire object, ignoring the row-level context of my dimension. 

 

How can I force the Set Analysis to evaluate the Previous Week comparison for every single row of my table (a row is a week) ?

 

Result expected:

WeekDate Count of NewComer
23/02/2026 12
02/03/2026 8
09/03/2026 15
... ...

 

Thanks for your help!

 

Labels (2)
6 Replies
BIAKS
Creator
Creator

Can you try this:

Count(
  Aggr(
    IF(
      Count(Issue_ID) + Sum({1} 0) > 0 
      AND 
      RangeSum(Above(Count(Issue_ID)), 0) = 0,
      1
    ),
    WeekDate, Issue_ID
  )
)
marcus_sommer
MVP
MVP

It's not an issue with the set analysis which is quite the same as a selection which is in general global and working against the column-level of the data-set.

If a row-level comparing is wanted it must be applied within any conditional-functions - most common are if-loops. In your scenario it won't work against a period-information as object-dimension because the data of the current week doesn't belong to the previous one and revers. It's not a matter of any condition else it relates to the relationship of the data.

A quite similar topic is discussed here: new customers trend over time - Qlik Community - 2544952 

Daniel_Castella
Support
Support

Hi @Thibo74 

 

These transformations are better to be applied in the script. For example, if your input data are two columns issue_id and WeekDate, you can apply this transformation in the script:

MAP:
Mapping
LOAD
Date(WeekDate+7,'DD/MM/YYYY')&issue_id as PastWeek,
'0' as Flag
FROM [lib://DataFiles/Test week dates.xlsx]
(ooxml, embedded labels, table is Sheet1);

A:
LOAD
WeekDate,
issue_id ,
ApplyMap('MAP',Date(WeekDate,'DD/MM/YYYY')&issue_id,1) as Flag
FROM [lib://DataFiles/Test week dates.xlsx]
(ooxml, embedded labels, table is Sheet1);

 

In this way, you create a flag field that will be 1 for the Newcomers and 0 for the repeated ones.

 

Then in front end, you just need to apply this formula:

count({<Flag={'1'}>} issue_id)

 

You can find my data example attached.

 

Kind Regards

Daniel

Thibo74
Contributor II
Contributor II
Author

@Daniel_Castella : I can't calculate the number of incoming issues in a script because the scope of incoming issues can vary depending on the filters (for example, I want to see issues with priority P0). If an issue was P1 last week and then becomes P0 this week, then it's considered an incoming issue. I need everything to be done dynamically.

 

@marcus_sommer : 

I'll explore another way to bypass the row-level context limitations in the table:

1. I will create a flag in the script (Flag_Previous_Week)

2. I will load the data from Week W-1  and force WeekDate to align with Week W

3. This will allow every row in my table to 'see' both the curent state and the previous state of Issue_Id simultaneously 

By doing this, I think use Set Analysis like that : 

Count({$
<Flag_Current_Week = {1}, 
Issue_Id = E({
   $<Flag_Previous_Week={1}>
})
>}
Issue_Id)

 If I filtering on a specific dimension like Priority I think I will work...

 

I will update this thread if it works as expected.

 

Daniel_Castella
Support
Support

Hi @Thibo74 

 

Well, if the priority needs to be considered is as easy as introducing it in the mapping and the applymap key like:

Date(WeekDate+7,'DD/MM/YYYY')&issue_id &Priority as PastWeek,

 

I think it can also be done with a self join if a big number of filters are needed. I could try to refine the code if you provide us with a data sample, to better replicate your issue in our end.

 

Kind Regards

Daniel 

Thibo74
Contributor II
Contributor II
Author

Hello, 

Hi all,

Following my previous messages, I wanted to share the solution I’ve implemented to track weekly Inflow and Outflow.

To compare a ticket's state between Week N and Week N−1 on a single time axis, I performed a self-concatenate in the script. I projected the previous week's data onto the current week's date using two flags.

Initial Data:

Issue_ID WeekDate Status Title priority
1000 09/03/2026 Status3 Test Issue 1 P0
1001 09/03/2026 Status2 Test Issue 2 P1
1002 09/03/2026 Status1 Test Issue 3 P1
1000 02/03/2026 Status2 Test Issue 1 P0
1001 02/03/2026 Status2 Test Issue 2 P1

 

Realigned Data (Current vs. Previous flags):

Issue_ID WeekDate Status Title priority Flag_Current_Week Flag_Previous_Week
1000 09/03/2026 Status3 Test Issue 1 P0 1 0
1001 09/03/2026 Status2 Test Issue 2 P1 1 0
1002 09/03/2026 Status1 Test Issue 3 P1 1 0
1000 09/03/2026 Status2 Test Issue 1 P0 0 1
1001 09/03/2026 Status2 Test Issue 2 P1 0 1
1000 02/03/2026 Status2 Test Issue 1 P0 1 0
1001 02/03/2026 Status2 Test Issue 2 P1 1 0
1000 02/03/2026 Status1 Test Issue 1 P0 0 1
1001 02/03/2026 Status1 Test Issue 2 P1 0

1

 

By aligning both records on the same WeekDate, I can now identify an Inflow (a new ticket) by checking if the ID exists in the current snapshot but has a sum of 0 in the previous one:


Count({<Flag_Current_Week={1}>} DISTINCT 
    If(Aggr(Sum(Flag_Previous_Week), WeekDate, Issue_ID) = 0, Issue_ID)
)

In my case, if I filter only issues with Status2, I have 2 inflow at 02/03/2026 and 1 outflow at 09/03/2026

 

I don't understand why E() didn't work something like that : 

Count({$
<Flag_Current_Week = {1}, 
Issue_Id = E({
   $<Flag_Previous_Week={1}>
})
>}
Issue_Id)