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

Multiple alternate states expression/comparison question

I have a view where I have 7 different alternate states.  The user can find a population of patients in each 'state' then I have a chart that compares the 7 states and shows how many states each patient falls into.

Here are the column headers:

Each column (C1, C2, etc) has an expression like this:


=Sum({C1}[Patient Counter])

There will be a 1 if the patient is in that state or a zero if not.

Then I have a 'Sum' column that reports how many states each patient falls into:


=C1+C2+C3+C4+C5+C6+C7

My final column is a link to the chart in our electronic health record.  Right now I am getting some blank values at random points and I can't figure out why.  Here is the expression I am using for that column:

=If(C7=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C6=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C5=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C4=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C3=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C2=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink],

If(C1=1,[Patient MRN]&'<url>'&[EPIC Patient Hyperlink]

)))))))

Since I have to put this hyperlink as an expression (I wish we could do dimensions as expressions) I have to use an expression so I don't get every patient.  This chart is NOT in an alternate state since I need it to ready all the states.  Everything works well except that last column.  Does anyone have an neat ideas on this?

Thanks!

1 Solution

Accepted Solutions
phcaptjim
Creator
Creator
Author

Thanks Sunny!

I had to apply the ONLY function to both sides of the expression and now it's working properly.  YAHOO!!

=If(C7=1,Only({C7}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C6=1,Only({C6}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C5=1,Only({C5}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C4=1,Only({C4}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C3=1,Only({C3}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C2=1,Only({C2}[Patient MRN])&'<url>'&Only({C2}[EPIC Patient Hyperlink]),

If(C1=1,Only({C1}[Patient MRN])&'<url>'&Only({C1}[EPIC Patient Hyperlink])

)))))))

View solution in original post

15 Replies
sunny_talwar

May be like this

=If(C7=1,Only({C7}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C6=1,Only({C6}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C5=1,Only({C5}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C4=1,Only({C4}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C3=1,Only({C3}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C2=1,Only({C2}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink],

If(C1=1,Only({C1}[Patient MRN])&'<url>'&[EPIC Patient Hyperlink]

)))))))

phcaptjim
Creator
Creator
Author

Thanks Sunny!

I had to apply the ONLY function to both sides of the expression and now it's working properly.  YAHOO!!

=If(C7=1,Only({C7}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C6=1,Only({C6}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C5=1,Only({C5}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C4=1,Only({C4}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C3=1,Only({C3}[Patient MRN])&'<url>'&Only({C3}[EPIC Patient Hyperlink]),

If(C2=1,Only({C2}[Patient MRN])&'<url>'&Only({C2}[EPIC Patient Hyperlink]),

If(C1=1,Only({C1}[Patient MRN])&'<url>'&Only({C1}[EPIC Patient Hyperlink])

)))))))

sunny_talwar

Awesome

phcaptjim
Creator
Creator
Author

One additional wrinkle to this question, how do I omit any selections from the stateless portion of the app when this expression?  If only certainly patients are selected in the main, only those links will appear in my chart so I need to omit all selections in this expression.

sunny_talwar

It seems like everything has a state... what is stateless here?

phcaptjim
Creator
Creator
Author

The patient MRN and patient hyperlink are actually coming from the stateless portion of the application.  Thus selections that are applied to each state don't apply to those two fields.  I'm probably doing a great job of explaining this but each population (C1, C2, etc) has different selections applied to it but those two values that we are using above are not filtered based on any of those states.  Does that help?

sunny_talwar

Not entirely sure I understand... I am not sure what you are getting right now and what do you expect to get.... May be if you can show what you are getting through screenshots and explain what is needed, I might be able to help you

phcaptjim
Creator
Creator
Author

In my alternate state comparison chart I have 3 patients (MRN 1111, 2222, 3333)

In the main application lets say we have two patients selected, MRN 1111, 2222

So my comparison chart will look something like this:

MRN          C1          C2          C3          Summary

1111          1               0               0             1

2222          1               0              0             1

               1               0                0             1

The MRN value for the third patient is not showing since it's not selected in the main portion of the application. If I unselect all from the main app, I would get this:

MRN          C1          C2          C3          Summary

1111          1               0               0             1

2222          1               0              0             1

3333           1              0              0             1

Hopefully that helps.

sunny_talwar

You are still seeing 1s and 0s, but not the MRN itself

Capture.PNG