Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sagnikrana
Partner - Contributor II
Partner - Contributor II

AND OR in Set Analysis

Hi everyone,

 

This is a typical and/or question in set analysis where I am stuck for a long time.

 

QlikQues.jpg

 

I want to sum the amount for those ids, where:

1. type_of_entry is both 'Revenue and Expense' or 'Revenue and Labor'

2. revenue type is 'CAF'

 

Expected ids are shown in bold colors

Eg...id 1 exists for both revenue and expense. Similarly, id 2 and 3 exist for both revenue and labor.

Result - > amount = 55 (5+40+10)

 

I have tried the below set analysis but is not working:

sum({<type_of_entry = {'Expense','Labor'}>*<type_of_entry = {'Revenue'}>*<revenue_type={'CAF'}>}amount)

 

I would appreciate any help on this.

Regards

Sagnik

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Sum({<id = p({<type_of_entry = {'Expense','Labor'}>})*p({<type_of_entry = {'Revenue'}>}), revenue_type = {'CAF'}>} amount)

View solution in original post

3 Replies
sunny_talwar

Try this

Sum({<id = p({<type_of_entry = {'Expense','Labor'}>})*p({<type_of_entry = {'Revenue'}>}), revenue_type = {'CAF'}>} amount)
sagnikrana
Partner - Contributor II
Partner - Contributor II
Author

Thank you so much!

It worked. I can see you used p() in the equation which filtered out the ids. I learned something new today.

Is there any document for these advanced functions which I can refer to?

sunny_talwar

You can check this document for set analysis

Set Analysis