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: 
lsteere01
Contributor
Contributor

Set Analysis with variable


I posted a question earlier today and got a quick answer. This problem is similar but slightly different.

I need to subract the value in a variable (vLookback) from the value in the field [Days Old]. The following does not work:

Count({<[Days Old]-$(vLookback)={">=6574<=27393"}>}distinct MRN)

Any ideas?

Thanks.

4 Replies
sunny_talwar

Why not do this on the other side of the expression:

Count({<[Days Old]={">=$(=6574+$(vLookback))<=$(=27393+$(vLookback))"}>}distinct MRN)

a-b=c is equivalent to a = b + c, right?

Let me know if this doesn't work.

Best,

Sunny

lsteere01
Contributor
Contributor
Author

That is true but I'd like to streamline the set analysis if possible, to make it easier to read and possibly run a bit faster.

sunny_talwar

Try this in that case: (Havn't tested it, but it should work

Count({<[Days Old]={'[Days Old] - $(vLookback) >= 6574 and [Days Old] - $(vLookback) <= 27393'}>}distinct MRN)


Sunny

ramoncova06
Specialist III
Specialist III

Or you could try with an intersection

Count({

<[Days Old]-$(vLookback)={">=6574"}>

*

<[Days Old]-$(vLookback)={"<=27393"}>

}distinct MRN)