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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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
MVP
MVP

maybe this:

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
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.