Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ttal7878
Creator
Creator

Set Analysis -problem

Hi,

Is the order of the dimensions important when performing a calculated in Set Analysis?


In the example attached, I am trying to count the ID's where source='online' and SaleDate between the Variables- vMinTimeStamp and vMaxTimeStamp and ignore the dimension-source

I have defined the variebles-

Let vMinTimeStamp =Timestamp(min(SaleDate),'YYYY-MM-DD hh:mm:ss')

Let vMaxTimeStamp= Timestamp(max(SaleDate),'YYYY-MM-DD hh:mm:ss')

in Set Analysis I have tried:

=count({$<SaleDate = {">=$(vMinTimeStamp)<= $(vMaxTimeStamp)"},source ={'online'},source = >}ID)

but it's not working, becouse I want to ignore the dimension "source"

In addition, I noticed that if I write in the beginning of the Set Analysis:  source =

like this:

=count({$<source = ,SaleDate = {">=$(vMinTimeStamp)<= $(vMaxTimeStamp)"},source ={'online'}>}ID)


the result is changing, why?? is the order in set analysis important?



My expectation should be displayed like this:

**if the user selects the sorce='email' - the result will not change,

the result will change only when the user selects SaleDate


1.JPG





Appreciates any help!

1 Solution

Accepted Solutions
sunny_talwar

I think dreamer4‌ is right. Because your date change based on selection in source field, the value of the count also changes. I used this for the variables

vMaxTimeStamp

=Timestamp(max({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')

vMinTimeStamp

=Timestamp(min({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')

View solution in original post

15 Replies
PrashantSangle

Hi,

It is showing as per logic you build.

On selection of email from source field your min value is changing because of that your end output is changing.

for that you have to nullify source = in variable definition.

Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

I think dreamer4‌ is right. Because your date change based on selection in source field, the value of the count also changes. I used this for the variables

vMaxTimeStamp

=Timestamp(max({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')

vMinTimeStamp

=Timestamp(min({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')

ttal7878
Creator
Creator
Author

What do you mean by "nullify source = in variable definition"

Can you show this in the example I attached?

ttal7878
Creator
Creator
Author

Wow you are amazing !!

But,

In my original model, I have several Text Object , some of which I want to ignore the source dimension and some not,

How can i deal with this, when the user selects a date range?

PrashantSangle

update your variable definition as sunny suggested. nullify means ignoring your selection

min({<source=>}date).


regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Miguel_Angel_Baeyens

Your initial expression used "source" twice, whenver you want to avoid a field value to be considered, use the same field with an equal and nothing on the right, like:

=count({$<source=, SaleDate = {">=$(vMinTimeStamp)<= $(vMaxTimeStamp)"} >} ID)

The filter for SaleDate will work but regardless what has been selected in field "source"

sunny_talwar

May be create two set of variables... one when you ignore selection in source and other where you don't

vMaxTimeStampIgnoreSource

=Timestamp(max({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')

vMinTimeStampIgnoreSource

=Timestamp(min({<source>}SaleDate),'YYYY-MM-DD hh:mm:ss')


vMaxTimeStamp

=Timestamp(max(SaleDate),'YYYY-MM-DD hh:mm:ss')

vMinTimeStamp

=Timestamp(min(SaleDate),'YYYY-MM-DD hh:mm:ss')

ttal7878
Creator
Creator
Author

OK Sunny,

i can create two set of variables

but in the Input box in which the user selects date range, which variables I should put ?