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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Count the first occurrences using set analysis

Hi folks, have a table

 

Micki_0-1602500384264.png

 

My measure:

 

count(
	aggr(
	if(	{<
		[State] ={'Closed', 'Resolved'},		
		>} FirstSortedValue([Id], -[Week]), 1,0), [Id]))

 

And it's not working what i want to count 1 in 21-Sep-2020 and that it, Could you please help ?

thank you in advance

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

@Micki May be try this

Sum(Aggr(

    If(Week = Min({<State = {'Closed', 'Resolved'}>}TOTAL <Id> Week), 1, 0)

, Id, Week))

View solution in original post

4 Replies
Vegar
MVP
MVP

Your SET modifier is misplaced outside of the aggregation function.

Try it like this.

count(
	aggr(
	if(	FirstSortedValue({<
		[State] ={'Closed', 'Resolved'},		
		>} [Id], -[Week]), 1,0), [Id]))
Micki
Creator
Creator
Author

not working:( 

Micki_0-1602501926249.png

 

sunny_talwar

@Micki May be try this

Sum(Aggr(

    If(Week = Min({<State = {'Closed', 'Resolved'}>}TOTAL <Id> Week), 1, 0)

, Id, Week))
Micki
Creator
Creator
Author

@sunny_talwar Thank you so much!!!