Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

convert if statement to set analysis

Hello,

I'm relatively new to Qlikview and am still getting to grips with set analysis.

I have a straight chart with a Cyclic group (7 fields) and 6 expressions. I have made one of the cyclic groups conditional with the 'if' statement '

 

=if (TIMEKEEPER.INACTIVE = 'N', TIMEKEEPER_HIST.DETAILS) '

  Both of the above are string fields.This works fine but takes an awfully long time to return any data. My understanding is that set analysis should make this much quicker, but I can't seem to get the equivant expression....everything I try results in 'Error in calculated dimension' being displayed on the chart for that dimension. e.g.  =maxstring({$<TIMEKEEPER.INACTIVE={'N'}>}TIMEKEEPER_HIST.DETAILS)

Can anyone give me the equivalent set analysis expression?

Thanks, Gavin

1 Solution

Accepted Solutions
Not applicable
Author

This was very close - what I was actually looking for was

 

=aggr(maxstring({$<TIMEKEEPER.INACTIVE={'N'}>}TIMEKEEPER_HIST.DETAILS),TIMEKEEPER_HIST.DETAILS)

Gavin

View solution in original post

5 Replies
SunilChauhan
Champion II
Champion II

use below

aggr(maxstring({$<TIMEKEEPER.INACTIVE={'N'}>}TIMEKEEPER_HIST.DETAILS),TIMEKEEPER.INACTIVE)

hope this helps

Sunil Chauhan
Anonymous
Not applicable
Author

Hi,

  according to my understanding,you max value will be changed based on Cyclic group.

=max({$<TIMEKEEPER.INACTIVE={'N'}>} aggr(TIMEKEEPER_HIST.DETAILS),getcurrentfield(yourgroupname))

what ever the dimension will be change based on that max value wll be pick.

Regards


Not applicable
Author

Thanks for your reply. I have tried that and, whilst an error is no longer generated, only a single row of data is returned (I'm expected around 150 rows once the "TIMEKEEPER.INACTIVE={'N'}" condition has been applied)?

Can you suggest how I might return all relevant rows of data?

Gavin

Not applicable
Author

Thanks for the reply. The if statement / set analysis statement only needs to apply to a single field (TIMEKEEPER_HIST.DETAILS) in the cyclic group. The other fields in the group are returning the correct data.

Gavin

Not applicable
Author

This was very close - what I was actually looking for was

 

=aggr(maxstring({$<TIMEKEEPER.INACTIVE={'N'}>}TIMEKEEPER_HIST.DETAILS),TIMEKEEPER_HIST.DETAILS)

Gavin