Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF statements

Hi there...

Im new to this

does anyone know why this will not work as an IF statement in Set Analysis

= IF(

Thanks

({<TheMonth = {'Feb 2012'}>})= "Feb 2012", 0, 1)

Im trying to return the value of 0 if this is equals to "Feb 2012"

5 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You cannot use Set analysis as if then.

     Sum({<TheMonth = {'Feb 2012'}>} Sales) it returns Feb 2012 sales its like applying a filter internally.

Celambarasan

Not applicable
Author

hi,

use it simply as:

if(TheMonth='Feb 2012',0,1)...u cannot use set analysis with if statements

Not applicable
Author

Superb, thanks..

I worked this out.. to sum up the results from the last two months ..)

= SUM(

IF(

IF(MonthName(AddMonths(Today(), -2)) = TheMonth, MonthName(AddMonths(Today(), -2)), MonthName(Today()))

, 1, 0)

If i wanted to filter the above also with: StatusCategoryCode = {"AT"}

"as used in set analysis in a previous example", has anyone got any ideas, thanks

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Could you tell what your trying to achieve count of something?

      Count({<TheMonth = {">=$(MonthName(Today(), -2))"},StatusCategoryCode = {"AT"}>} UniqueFieldName)

Celambarasan

Not applicable
Author

you can define a variable (say vMonth)  as:

Capture.PNG

sum({$<Month={$(vMonth)}, year={'2011'}, StatusCategoryCode={'AT'}>}Sales)