Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
q11hhg
Contributor III
Contributor III

Set Analysis with multiple conditions

Hi there , I have a calculation as below 

count({$<
[Event Type] = {'Login'}>*
<[Customer ID] = {"=sum([Total Events])>=2"}
>} distinct [Customer ID] )

and I want to add a date filter inside to only count the last 12 months:

 count({$<
[Event Type] = {'Login'}>*
<[Customer ID] = {"=sum([Total Events])>=2"},
Date={">=$(=date(addmonths(Max(Date),-12),'DD/MM/YYYY'))<=$(=date(Max(Date),'DD/MM/YYYY'))"}
>} distinct [Customer ID] )

 

but it does not give me the expected result, could you please help me?

 

Labels (1)
1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

I'd suggest you to check the below expressions in a text object first.

=date(addmonths(Max(Date),-12),'DD/MM/YYYY')

=date(Max(Date),'DD/MM/YYYY')

what do you get?

View solution in original post

7 Replies
agigliotti
Partner - Champion
Partner - Champion

did you try to replace time period with values ex. Date={">=01/01/2020<=26/02/2021"} and see what you get?

q11hhg
Contributor III
Contributor III
Author

Yes I did, it returns the same result as without the date filter.

agigliotti
Partner - Champion
Partner - Champion

I'd suggest you to check the below expressions in a text object first.

=date(addmonths(Max(Date),-12),'DD/MM/YYYY')

=date(Max(Date),'DD/MM/YYYY')

what do you get?

q11hhg
Contributor III
Contributor III
Author

looks like  these , seems like a real date?

q11hhg_1-1614337244102.png

and the expression is also fine ?

q11hhg_0-1614337223404.png

 

agigliotti
Partner - Champion
Partner - Champion

I'd say yes, maybe you are getting the right result based on your data.
let's try changing the time period ex. >=14/02/2020<=14/02/2020 to see what happens...

q11hhg
Contributor III
Contributor III
Author

Thank you,  I just double-checked, it is correct.

q11hhg
Contributor III
Contributor III
Author

Hi @agigliotti , the calculation in the chart is fine , but when I use a table chart, the max date does not work. It only gives me the count of that month, not the last 12 month.

q11hhg_1-1614604537676.png

for example , in the first row 2020-Dec, the result should be 7952, but it only show the month of December 2020.

how should I fix this?