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

Compare same variable in two alternate states

Hi

I have two alternate states: "OG_20172018+0" and the following year "OG_20172018+1".  In a chart/pivot table, which is set to be in the alternate state "OG_20172018+1", I have the following expression:

=(count({<
Rnr = P({"OG_20172018+0"<Lvl = {1}>}),
Group -= {"I", "U", "X"},
Lvl-= {">1"}
>}
DISTINCT if((Standardfilter = 1 or Standardfilter_2prioritet =1),
Rnr)))

Where Rnr is an reference number for each person, Lvl is a numeric variable indication which level each person are at, Group indicates which group the person are in, and Standardfilter and Standardfilter_2prioritet  is [0,1]-indicators.

So far, so good. I get a list of 215 uniqe Rnr's. These Rnr's are in both states and they have the features in the expression.

Then i have another variable "Category" which is a text variable. For each of the 215 Rnr's i want to check if the Category-variable are identical in both states , and I want  count these Rnr's.

I have tried to find post in the community to help me, but I am still stuck! Please, can anybody help me?

Regards,

Torbjørn

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

My bad, try this instead

=(count({<
Rnr = P({"OG_20172018+0"<Lvl = {1}>}) * {"=Only({[OG_20172018+0]} Category) = Only({[OG_20172018+1]} Category)"},
Group -= {"I", "U", "X"},
Lvl-= {">1"}
>}
DISTINCT if((Standardfilter = 1 or Standardfilter_2prioritet =1),
Rnr)))

Changed the double quotes around the state name to []. The reason is that we already have a "" used in the set.....

View solution in original post

4 Replies
sunny_talwar

May be this

=(count({<
Rnr = P({"OG_20172018+0"<Lvl = {1}>}) * {"=Only({"OG_20172018+0"} Category) = Only({"OG_20172018+1"} Category)"},
Group -= {"I", "U", "X"},
Lvl-= {">1"}
>}
DISTINCT if((Standardfilter = 1 or Standardfilter_2prioritet =1),
Rnr)))
Mr_small_t
Contributor III
Contributor III
Author

Hi Sunny

thanks for your reply! I see what you are trying. But it did not work ("Errors in expression") and I have not been able to "adjust" it to make it run.  And suggestions?

 

Regards

Torbjørn

sunny_talwar

My bad, try this instead

=(count({<
Rnr = P({"OG_20172018+0"<Lvl = {1}>}) * {"=Only({[OG_20172018+0]} Category) = Only({[OG_20172018+1]} Category)"},
Group -= {"I", "U", "X"},
Lvl-= {">1"}
>}
DISTINCT if((Standardfilter = 1 or Standardfilter_2prioritet =1),
Rnr)))

Changed the double quotes around the state name to []. The reason is that we already have a "" used in the set.....

Mr_small_t
Contributor III
Contributor III
Author

That one works brilliant! Thank you!