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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to use AND operator in Set Analysis?

I need to get Sum of amount for current month and current year.

Sum({1<[DonationDate.autoCalendar.Month]={'$(=Month(Today()))'}*[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}>}Amount)

OR

Sum({1<[DonationDate.autoCalendar.Month]={'$(=Month(Today()))'},[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}>}Amount)

Its not working. If I use only Month then I get some value but if I use both then it returns nothing.

Also tried using , instead of *.

I am not getting  whats wrong in above code.

1 Solution

Accepted Solutions
vamsee
Specialist
Specialist

Operators are used while combining two sets.

OR -> +

AND -> *


In general,

Sum({<Set1>+<Set2>} Amt)

Sum({<Set1>*<Set2>} Amt)

Operator in Set Analysis

In your case , should work.

=Sum({1<[DonationDate.autoCalendar.Month]={"$(=Month(Today()))"},
[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}
>}Amount)

View solution in original post

4 Replies
agigliotti
Partner - Champion
Partner - Champion

maybe this:

=Sum( {1< [DonationDate.autoCalendar.Month] = {"$(=Month(Today()))"}, [DonationDate.autoCalendar.Year] = {"$(=Year(Today()))"} >} Amount )

joseph_eftamand
Partner - Creator
Partner - Creator

Are you trying to get the sum of the month and the year?

In that case you could do Sum({1<[DonationDate.autoCalendar.Month]={'$(=Month(Today()))'}>}Amount) +  Sum({<[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}>}Amount)


Apologies if I misunderstood your requirement.

keep in mind that that OR / AND in set analysis can be achieved by using you modifiers with * / + example:

Sum({<Unit = {'B'}>*<Warehouse = {'A'}>}Amount)

vamsee
Specialist
Specialist

Operators are used while combining two sets.

OR -> +

AND -> *


In general,

Sum({<Set1>+<Set2>} Amt)

Sum({<Set1>*<Set2>} Amt)

Operator in Set Analysis

In your case , should work.

=Sum({1<[DonationDate.autoCalendar.Month]={"$(=Month(Today()))"},
[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}
>}Amount)

Anonymous
Not applicable
Author

Thanks everyone.

Sum({1<[DonationDate.autoCalendar.Month]={'$(=Month(Today()))'},[DonationDate.autoCalendar.Year]={"$(=Year(Today()))"}>}Amount)

Above worked.

And I did not reload data after I did some changes to data. Hence was unable to get result.