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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
priya945
Creator
Creator

set analysis and if statement together

Hi All,

Being new to QV world, trying to understand set analysis and if statement together.  I have found below expression. Could someone help me to understand below in detail

If statement and set analysis togather

count({<Year=>}if(product='a',sale))

Thanks In advance,

Priya

4 Replies
sunny_talwar

All you are doing here is to ignore selection in Year field and Counting those sales where Product = 'a'... this can also be written like this

Count({<Year, product = {'a'}>} sale)

priya945
Creator
Creator
Author

Thanks Sunny but still I feel that below two expressions are different since both expressions are giving two different results when made a different selection

Count({<Year, product = {'a'}>} sale)

count({<Year=>}if(product='a',sale))

When I make any new selection in Product field then below is the result.

ramasaisaksoft

Hi Priya,

in simple words ,Normally when ever we have so many conditions we will go for Set Analysis on behalf of nested-If statements,

it means, sum set of data is separating from the entire set of data (Set Analysis).

coming to your example

1) Year = we call this one By passing the Filter ,simple example we are skipping the Filters which are user selections

in the field Year

2) If(Product='a',Sale) here we are finding the amount of sales when product='a'

count({<Year=>}if(product='a',sale))

Let us know if you didn't clear your doubt.

sunny_talwar

This will behave the same way now

Count({<Year, product *= {'a'}>} sale)

Read about the asterisk here

Implicit Set Operators