# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor

## 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
Valued Contributor

## Re: how to use AND operator in Set Analysis?

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)

4 Replies
Partner

## Re: how to use AND operator in Set Analysis?

maybe this:

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

Partner

## Re: how to use AND operator in Set Analysis?

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)

Valued Contributor

## Re: how to use AND operator in Set Analysis?

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)

New Contributor

## Re: how to use AND operator in Set Analysis?

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.