Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis, ensure one record is always displayed regardless of user selection

Hi,

I have a line graph with multiple lines being displayed. the dimensions that each line represents is the UserID. I have a specific UserID (-1) which I want to display regardless of the users selection.

So for example if there were 100 users and therefore 100 lines on the graph. If a user selects UserID's 1 to 50 I want it still to display the UserID -1. I realise this should be achieved with set analysis but am unable to achieve it.

The expression that I am currently using is:

IF(ProcessKey<>'0-1',

If(PositionEvent.Position='Middle' and Gender='Male',(EventTime),

If(PositionEvent.Position='Middle' and Gender='Female',(EventTime)*-1,

If(Gender='Male',0.001,-0.001))))

I believe I might need to use the MAX function to wrap the set analysis around?

So my aim is that the graph should show only the selected UserIDs based on the user's filters except regardless of the user's selection the UserID of -1 will be displayed.

Any assistance would be greatly appreciated.

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

This works as well and is maybe simpler:

Concat({<UserID=UserID+{'-1'}>} UserID)

View solution in original post

14 Replies
Nicole-Smith

See the set analysis in the attached.

stigchel
Partner - Master
Partner - Master

This works as well and is maybe simpler:

Concat({<UserID=UserID+{'-1'}>} UserID)

Not applicable
Author

Thank you both for your responses, both do exactly what I requested. I do have a small further addition. I really want to be able to always include two specific IDs. e.g. UserID = -1 OR -2 should be included regardless of the users other selections. I thought that would be simply enough to change myself but I'm struggling!

swuehl
MVP
MVP

Both user IDs should be shown?

Have you tried

... {<UserID=UserID+{'-1','-2'}>} ...


just add all user IDs to the set modifier field value list in curly brackets.

Not applicable
Author

That you that is spot, I feel slightly embarressed I didn't get the myself. Thank you for your help, I appreciate it.

Not applicable
Author

Hi,

I need to actually adjust the set analysis further.

The line I am using set analysis for is a reference line (it isn't a straight line so I could use the Qlikview built-in feature). I want to always be displaying the reference line (which is represented by UserID -2 and -1) regardless of the users other selections. Currently this set analysis means that if I set a criteria on just UserID it works. But when I then make a selection on the state, country, age group etc. the lines disappears (I realise this is what I originally requested). What I really want is for the set analysis to still include UserID -2 and .-1 regardless of the state filter etc.

However to complicate things further there is a field called ProcessStart and ProcessEnd. I still want the -2 and -1 lines to be filtered based on those fields.

So how can I adapt Concat({<UserID=UserID+{'-1','-2'}>} UserID) so that the set analysis ensures UserID -1 and -2 are always present except they should filter based on two specific fields 'ProcessStart' and 'ProcessEnd'.

Thanks for the help so far and appreciate you taking the time to answer this post.

Dan

Nicole-Smith

Try the following.  It should ignore all selections except for ProcessStart and ProcessEnd.


Concat({1<UserID=UserID+{'-1','-2'}, ProcessStart=P(ProcessStart), ProcessEnd=P(ProcessEnd)>} UserID)

Not applicable
Author

Hi Nicole,

That doesn't appear to work for me. The original expression I had which worked as requested but not quite as I wanted was:

MAX({<PatientID = PatientID+{'RefA', 'RefB'}>}

IF(PatientID='RefB' AND PositionProcess.Position='Middle', (TimeBetweenEvents),

IF(ProcessKey<>'0-1',

IF(PositionProcess.Position='Middle' and Gender='Male',(TimeBetweenEvents),

If(PositionProcess.Position='Middle' and Gender='Female',(TimeBetweenEvents),

IF(Gender='Male',0.0001,0.0001))))))

When I added in your suggestion I have:

MAX({<PatientID = PatientID+{'RefA', 'RefB'}, ProcessStage=P(ProcessStage), ProcessStage2=P(ProcessStage2)>}

IF(PatientID='RefB' AND PositionProcess.Position='Middle', (TimeBetweenEvents),

IF(ProcessKey<>'0-1',

IF(PositionProcess.Position='Middle' and Gender='Male',(TimeBetweenEvents),

If(PositionProcess.Position='Middle' and Gender='Female',(TimeBetweenEvents),

IF(Gender='Male',0.0001,0.0001))))))

This latest expression doesn't seem to even hold the RefA or RefB values when I make a selection within PatientID nor on any of the other fields. It does however keep the value when making selections on ProcessStage and ProcessStage2 fields.

Sorry I hope I am being clear enough.

Thanks

Dan