Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following expression and I would like to ignore the ISLAND_DEPT.DEPT_DESC selection and show the data for all depts.
SUM(AGGR(IF(FirstSortedValue(
{<
ADMIT_DT ={">= $(=NUM(ADDMONTHS(MONTHSTART(MAX(ISLAND_CALENDAR.DATE)),-12))) <=$(=MAX(ISLAND_CALENDAR.DATE))"},
FLG_Z_PATIENTS = {0},
>}
DISTINCT DEPT_ABBR,-ADMIT_DTTM)= ISLAND_DEPT.DEPT_ABBR,1,0),MRN,ISLAND_DEPT.DEPT_ABBR))
I have tried the following without any success.
SUM(AGGR(IF(FirstSortedValue(
{1<
ADMIT_DT ={">= $(=NUM(ADDMONTHS(MONTHSTART(MAX(ISLAND_CALENDAR.DATE)),-12))) <=$(=MAX(ISLAND_CALENDAR.DATE))"},
FLG_Z_PATIENTS = {0},
ISLAND_DEPT.DEPT_DESC=
>}
DISTINCT DEPT_ABBR,-ADMIT_DTTM)= ISLAND_DEPT.DEPT_ABBR,1,0),MRN,ISLAND_DEPT.DEPT_ABBR))
Any idea why adding the 1 or ISLAND_DEPT.DEPT_DESC does not work. Any ideas on how to get this to work would be greatly appreciated. Thank you.
That's what I suspected.
What about the alternate set? Is it acceptable for you?
Edit: It is "alternate state", not "alternate set"... Example attached.
If it achieves the behavior I am expecting that would be great. That chart should change anytime another dimension is selected such as date, gender, etc. The only dimension that should not affect this chart is the island_dept_abbr selection. It should always show all the depts. I have never done alternate states, would you be willing to give me an example? Thanks again.
I have looked at the example you provided and every time I select PCR in the list box, the straight table still shows only PCR and not WHCY. I would expect the table to also show WHCY.
Hmm... What is your QV version? Alternate set didn't exist before QV11.
So I figured out how to do this on our server. My local copy was still 10.0, I am upgrading now. The issue I see with alternate states is that I still need the chart to change if any other dimension is selected. Right now the alternate state only changes when the alternate list box is used. Does that make sense?
This is what the alternate states for. In your case, use that list box in an alternate state, and all other filters and chart itself in another (inherited in my example).
Take a look at the examples which come with QV installation, they are quite good.
So the alternate states kind of work. In your example it definitely gives me what I expect, but now if I add in another dimension such as gender, race, etc, I would expect the numbers in the straight table to change, but they don't because either they are associated with the alternate state or if they are using the inherited state none of my other charts change when changing the dept in the list box.
This is more or less correct.
You have to choose what to keep in the inherited state, and what in the alternate states. If only this list box should not affect this chart, it makes sense to keep this chart and all other filters (gender, race, etc.) in the inherited state, and only this particular list box in an alternate state.
You still can enforce the selections in an alternate state to affect objects in another state - see the example from QlikTech if you need this.
Regards,
Michael
Michael,
I did some searching and I think I am really close. I read some more about alternate states and using implicit field value definitions. I am running into one issue. I the expression for the table I have altered it to be
(AGGR(IF(FirstSortedValue(
{<
ADMIT_DT ={">= $(=NUM(ADDMONTHS(MONTHSTART(MAX(ISLAND_CALENDAR.DATE)),-12))) <=$(=MAX(ISLAND_CALENDAR.DATE))"},
FLG_Z_PATIENTS = {0},
ISLAND_DEPT.DEPT_ABBR = [Alt1]::ISLAND_DEPT.DEPT_ABBR
>}
DISTINCT DEPT_ABBR,-ADMIT_DTTM)= ISLAND_DEPT.DEPT_ABBR,1,0),MRN,ISLAND_DEPT.DEPT_ABBR))
It isn't working because of the AGGR function that is still aggregating over the non-alternate state dept. abbr field. How can I get around this? I really appreciate all of the help. I have learned a ton today.
Thomas,
If the chart is in the inherited state, and you want it to be independent from the dept (ISLAND_DEPT.DEPT_ABBR in Alt1 state) selection, you should not use this:
ISLAND_DEPT.DEPT_ABBR = [Alt1]::ISLAND_DEPT.DEPT_ABBR.
This is exactly what creates dependency between objects in the different states which you want to avoid, I believe.
I thought my attachment worked exactly the way you wanted. If not, need clarification. Or, is it a different chart this time?
As for the AGGR, I can't tell if it's possible to use alternate state with it. Try to post it as a new question, very likely there is a solution that I'm not aware of.
Additional, info, not exactly related, but maybe useful - one more way of working with alternate states, especially when you are comfortable with set analysis. In addition to {1} and {$}, you can use {Alt1} - selection in state. For example:
sum({<Field1 = {'ABC'}> * Alt1<Field2={'XYZ'}>} Amount)
Returns sum of Amount with conditions Field1 = 'ABC' in the state of the current object, and Field2='XYZ' in the alternate state Alt1. It gives you additional flexibility.
Regards,
Michael