Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
svanderwerf
Partner - Contributor
Partner - Contributor

Counting occurences that match aggregated conditions

Hi All,

For a certain project we defined several milestones and several deliverables. Below is some sample data:

Del. No. Planned delivery date MilestoneCode Planned finish date
1.11-3-20131.11-2-2013
1.11-3-20132.11-6-2013
2.11-6-20133.11-12-2013
2.11-6-20134.21-12-2013
2.11-6-20135.11-2-2014
2.11-6-20136.11-8-2014
2.11-6-20136.21-5-2014
2.21-8-20153.11-12-2013
2.21-8-20154.21-12-2013
2.21-8-20155.11-2-2014
2.21-8-20156.11-8-2014
2.21-8-20156.21-5-2014
3.11-10-20134.21-12-2013
3.11-10-20136.11-8-2014
3.11-10-20136.21-5-2014
3.11-10-20137.11-5-2014
3.11-10-20138.11-10-2012
3.11-10-20138.21-11-2012
4.11-12-20136.11-8-2014
4.11-12-20136.21-5-2014
4.21-12-20136.11-8-2014
4.21-12-20136.21-5-2014
5.11-2-20146.11-8-2014
5.11-2-20146.21-5-2014
5.21-10-20136.11-8-2014
5.21-10-20136.21-5-2014
6.11-2-20147.11-5-2014
6.11-2-20147.21-12-2014
6.11-2-20147.31-2-2015
6.21-2-20147.11-5-2014
6.21-2-20147.21-12-2014
6.21-2-20147.31-2-2015
7.11-2-20158.11-10-2012
7.11-2-20158.21-11-2012
8.11-6-20156.11-8-2014
8.11-6-20156.21-5-2014
9.11-2-20139.11-11-2012
9.21-8-20159.11-11-2012

I wanted to filter the milestonecodes for each Del. no with the lowest planned finish date that is higher than the planned delivery date.

This is the expression I used:

=if([Planned finish date] = min(TOTAL <[Del. No.]> aggr(min(if([Planned finish date] >= [Planned delivery date], [Planned finish date])), [Del. No.])), 'Y')

The expression displays a 'Y' with each milestonecode that matches the condition explained above.

Now here comes the tricky part:

I want to know which Del. no only has one MilestoneCode that matches that condition.

In the table above Del. No. 1.1 only matches MilestoneCode 2.1 based on these conditions, but Del. No. 2.1 could be matched to Milestonecode 3.1 and 4.2.

Any idea on how I can accomplish a count of the number of MilestoneCodes per Del. No. that match these conditions?

(I want to know this, so that I can give the deliverables that can be matched to multiple Milestones a different background color in a table).

I hope someone can help me out.

Regards,

Stevan

3 Replies
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
svanderwerf
Partner - Contributor
Partner - Contributor
Author

Thanks Gysbert!

I already was looking at solving this issue in the load script. However, this limits flexibility of QVW.

Is there really no way to solve it in an expression?

Gysbert_Wassenaar

Yes, see the other charts in the example I posted.


talk is cheap, supply exceeds demand