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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis

Hi,

I have ID, Date and Flag in a table.

IDWeekFlagRow_No
1w33Y1
1w33Y2
1w33N3
2w33Y4
2w34Y5
3w34Y6

Now I have to count the IDs which have only Y status in the week selected. In this example, for w33, only ID-2 has to be counted.

I have tried to acheive this with set analysis count({<FLAG={'Y'},Row_No={"=max(Row_No)"}>}distinct ID). But it didn't work.

Any idea on this?

2 Replies
swuehl
MVP
MVP

Try

= -sum( aggr( FirstSortedValue(Flag, -Row_No) = 'Y', ID))

assuming the 'N' status flag will appear only on the highest Row_No per ID.

whiteline
Master II
Master II

Hi

You can try this one (use different quotes carefully as stated below):

=count({<FLAG={'Y'}, Row_No={"=max({<FLAG={'Y'}>} Row_No)"}>} distinct ID)